From: Toine Siebelink Date: Fri, 12 Mar 2021 16:04:00 +0000 (+0000) Subject: Merge "Move web security configuration to application module" X-Git-Tag: 1.1.0~104 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=344434b68c2418c6e901e7acab02886be6e6b1cb;p=cps.git Merge "Move web security configuration to application module" --- 344434b68c2418c6e901e7acab02886be6e6b1cb diff --cc cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy index 22b5b04292,05bd41d305..fb4037271b --- a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy @@@ -154,31 -167,13 +153,12 @@@ class CpsRestExceptionHandlerSpec exten new SchemaSetInUseException(dataspaceName, existingObjectName)] } - def 'Get request without authentication is not authorized'() { - when: 'request is sent without authentication' - def response = - mvc.perform(get("$basePath/v1/dataspaces/dataspace-name/anchors")).andReturn().response - then: 'HTTP Unauthorized status code is returned' - assert UNAUTHORIZED.value() == response.status - } - - def 'Get request with invalid authentication is not authorized'() { - when: 'request is sent with invalid authentication' - def response = - mvc.perform( - get("$basePath/v1/dataspaces/dataspace-name/anchors") - .header("Authorization", 'Basic invalid auth')) - .andReturn().response - then: 'HTTP Unauthorized status code is returned' - assert UNAUTHORIZED.value() == response.status - } - /* - * NB. The test uses 'get JSON by id' endpoint and associated service method invocation + * NB. The test uses 'get anchors' endpoint and associated service method invocation * to test the exception handling. The endpoint chosen is not a subject of test. */ - def setupTestException(exception) { - mockCpsAdminService.getAnchors(_) >> { throw exception} + mockCpsAdminService.getAnchors(_) >> { throw exception } } def performTestRequest() {