From dc8d648fa7b642ca88c7b101ceb8188b5c5ed3e3 Mon Sep 17 00:00:00 2001 From: Julien Fontaine Date: Tue, 2 Mar 2021 18:18:30 -0500 Subject: Add delete endpoint for config snapshot API Add delete endpoint to delete config-snapshots based on resource-type, resource-id and resources-status. Issue-ID: CCSDK-3205 Signed-off-by: Julien Fontaine Change-Id: Id7954694bc93beba08a79139834cb6477cb8e44b --- .../api/ResourceConfigSnapshotControllerTest.kt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin') diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt index 58d5726bb..1a2fb6187 100644 --- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt @@ -246,6 +246,50 @@ class ResourceConfigSnapshotControllerTest { } } + @Test + fun `deleteWithResourceIdAndResourceType returns 200 if valid path`() { + webTestClient + .delete() + .uri("/api/v1/configs/$resourceType/$resourceId/running") + .exchange() + .expectStatus().is2xxSuccessful + .expectBody() + webTestClient + .delete() + .uri("/api/v1/configs/$resourceType/$resourceId/candidate") + .exchange() + .expectStatus().is2xxSuccessful + .expectBody() + webTestClient + .delete() + .uri("/api/v1/configs/$resourceType/$resourceId") + .exchange() + .expectStatus().is2xxSuccessful + .expectBody() + } + + @Test + fun `deleteWithResourceIdAndResourceType returns 400 if invalid path`() { + webTestClient + .delete() + .uri("/api/v1/configs/ /$resourceId/running") + .exchange() + .expectStatus().is4xxClientError + .expectBody() + webTestClient + .delete() + .uri("/api/v1/configs/$resourceType/ /running") + .exchange() + .expectStatus().is4xxClientError + .expectBody() + webTestClient + .delete() + .uri("/api/v1/configs/$resourceType/$resourceId/qwerty") + .exchange() + .expectStatus().is4xxClientError + .expectBody() + } + private fun post(resourceType: String, resourceId: String, status: String) { webTestClient .post() -- cgit 1.2.3-korg