|
@@ -110,6 +110,7 @@ class DeleteListItemsRouteADME2ESpec |
|
|
val lastChild = children.last |
|
|
lastChild.id should be("http://rdfh.ch/lists/0001/notUsedList03") |
|
|
lastChild.position should be(1) |
|
|
lastChild.children.size should be(1) |
|
|
// first child must have its child |
|
|
val firstChild = children.head |
|
|
firstChild.children.size should be(5) |
|
@@ -126,26 +127,39 @@ class DeleteListItemsRouteADME2ESpec |
|
|
) |
|
|
} |
|
|
|
|
|
"delete a list entirely with all its children" in { |
|
|
val encodedNodeUrl = java.net.URLEncoder.encode("http://rdfh.ch/lists/0001/notUsedList", "utf-8") |
|
|
"delete the single child of a node" in { |
|
|
val encodedNodeUrl = java.net.URLEncoder.encode("http://rdfh.ch/lists/0001/notUsedList031", "utf-8") |
|
|
val request = Delete(baseApiUrl + s"/admin/lists/" + encodedNodeUrl) ~> addCredentials( |
|
|
BasicHttpCredentials(anythingAdminUserCreds.user.email, anythingAdminUserCreds.password)) |
|
|
val response: HttpResponse = singleAwaitingRequest(request) |
|
|
response.status should be(StatusCodes.OK) |
|
|
val deletedStatus = AkkaHttpUtils.httpResponseToJson(response).fields("deleted") |
|
|
deletedStatus.convertTo[Boolean] should be(true) |
|
|
val node = AkkaHttpUtils.httpResponseToJson(response).fields("node").convertTo[ListNodeADM] |
|
|
node.getNodeId should be("http://rdfh.ch/lists/0001/notUsedList03") |
|
|
val children = node.getChildren |
|
|
children.size should be(0) |
|
|
} |
|
|
} |
|
|
|
|
|
clientTestDataCollector.addFile( |
|
|
TestDataFileContent( |
|
|
filePath = TestDataFilePath( |
|
|
directoryPath = clientTestDataPath, |
|
|
filename = "delete-list-response", |
|
|
fileExtension = "json" |
|
|
), |
|
|
text = responseToString(response) |
|
|
) |
|
|
"delete a list entirely with all its children" in { |
|
|
val encodedNodeUrl = java.net.URLEncoder.encode("http://rdfh.ch/lists/0001/notUsedList", "utf-8") |
|
|
val request = Delete(baseApiUrl + s"/admin/lists/" + encodedNodeUrl) ~> addCredentials( |
|
|
BasicHttpCredentials(anythingAdminUserCreds.user.email, anythingAdminUserCreds.password)) |
|
|
val response: HttpResponse = singleAwaitingRequest(request) |
|
|
response.status should be(StatusCodes.OK) |
|
|
val deletedStatus = AkkaHttpUtils.httpResponseToJson(response).fields("deleted") |
|
|
deletedStatus.convertTo[Boolean] should be(true) |
|
|
|
|
|
clientTestDataCollector.addFile( |
|
|
TestDataFileContent( |
|
|
filePath = TestDataFilePath( |
|
|
directoryPath = clientTestDataPath, |
|
|
filename = "delete-list-response", |
|
|
fileExtension = "json" |
|
|
), |
|
|
text = responseToString(response) |
|
|
) |
|
|
} |
|
|
) |
|
|
} |
|
|
|
|
|
} |
|
|
} |