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() {