X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2Fclient%2FDmiRestClientSpec.groovy;h=809c48a619568ba7b864c59764adb8798e44ab44;hb=d469924472af98ce13c2bcb3d8b053d45322e806;hp=98bbe8748f7e9d545201197e067f4816268536f7;hpb=dc5ed75c841da857611713bceed8bf9988204d3d;p=cps.git diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy index 98bbe8748..809c48a61 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy @@ -35,7 +35,7 @@ class DmiRestClientSpec extends Specification { def objectUnderTest = new DmiRestClient(mockRestTemplate, mockDmiProperties) def 'DMI PUT operation.'() { - given: 'a get url' + given: 'a PUT url' def getResourceDataUrl = 'http://some-uri/getResourceDataUrl' and: 'dmi properties' setupTestConfigurationData() @@ -48,6 +48,20 @@ class DmiRestClientSpec extends Specification { result == mockResponseEntity } + def 'DMI POST operation.'() { + given: 'a POST url' + def getResourceDataUrl = 'http://some-uri/createResourceDataUrl' + and: 'dmi properties' + setupTestConfigurationData() + and: 'the rest template returns a valid response entity' + def mockResponseEntity = Mock(ResponseEntity) + mockRestTemplate.postForEntity(getResourceDataUrl, _ as HttpEntity, String.class) >> mockResponseEntity + when: 'POST operation is invoked' + def result = objectUnderTest.postOperationWithJsonData(getResourceDataUrl, 'json-data', new HttpHeaders()) + then: 'the output of the method is equal to the output from the test template' + result == mockResponseEntity + } + def setupTestConfigurationData() { mockDmiProperties.authUsername >> 'some-username' mockDmiProperties.authPassword >> 'some-password'