Merge "Move web security configuration to application module"
authorToine Siebelink <toine.siebelink@est.tech>
Fri, 12 Mar 2021 16:04:00 +0000 (16:04 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 12 Mar 2021 16:04:00 +0000 (16:04 +0000)
1  2 
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() {