diff options
author | Toine Siebelink <toine.siebelink@est.tech> | 2021-11-12 15:38:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-11-12 15:38:55 +0000 |
commit | 69662af73d817fa0bbf9d07f1a965594ca5bcef9 (patch) | |
tree | 572b802caf6ff200104cd4e1b4f87e75f83bed38 /src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy | |
parent | 02ee56be9d2ceaac2e8aa9069aecb3f44b5164c7 (diff) | |
parent | 5fe0daebb1360bd5d4c525125cdb0d6250583ff4 (diff) |
Merge "Support Update and Delete operations for DS Passtrough-Running in DMI Plugin"
Diffstat (limited to 'src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy')
-rw-r--r-- | src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy index 2184c7e7..8a3170b4 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy @@ -28,6 +28,11 @@ import org.springframework.http.ResponseEntity import org.springframework.web.client.RestTemplate import spock.lang.Specification +import static org.springframework.http.HttpMethod.GET +import static org.springframework.http.HttpMethod.POST +import static org.springframework.http.HttpMethod.DELETE +import static org.springframework.http.HttpMethod.PUT + class SdncRestconfClientSpec extends Specification { def mockSdncProperties = Mock(DmiConfiguration.SdncProperties) @@ -49,7 +54,7 @@ class SdncRestconfClientSpec extends Specification { result == mockResponseEntity } - def 'SDNC POST operation called.'() { + def 'SDNC #scenario operation called.'() { given: 'json data' def jsonData = 'some-json' and: 'a url for get module resources' @@ -59,12 +64,18 @@ class SdncRestconfClientSpec extends Specification { and: 'the rest template returns a valid response entity' def mockResponseEntity = Mock(ResponseEntity) when: 'get module resources is invoked' - def result = objectUnderTest.postOperationWithJsonData(getModuleResourceUrl, jsonData, new HttpHeaders()) + def result = objectUnderTest.httpOperationWithJsonData(expectedHttpMethod, getModuleResourceUrl, jsonData, new HttpHeaders()) then: 'the rest template is called with the correct uri and json in the body' 1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getModuleResourceUrl' }, - HttpMethod.POST, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity + expectedHttpMethod, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity and: 'the output of the method is the same as the output from the test template' result == mockResponseEntity + where: 'the following values are used' + scenario || expectedHttpMethod + 'POST' || POST + 'PUT' || PUT + 'GET' || GET + 'DELETE' || DELETE } def 'SDNC GET operation with header.'() { |