CPS-635 - Module Resource call does not include body
[cps.git] / cps-ncmp-service / src / test / groovy / org / onap / cps / ncmp / api / impl / operation / DmiOperationsSpec.groovy
index 987ab2b..6a1ce1a 100644 (file)
@@ -92,4 +92,18 @@ class DmiOperationsSpec extends Specification {
         then: 'the post operation is executed with the correct URL'
             1 * mockDmiRestClient.postOperation(expectedUrl, _ as HttpHeaders)
     }
+
+    def 'Call get resource from dmi with json data.'() {
+        given: 'expected url & json data'
+            def requestBody = 'some json'
+            def expectedUrl = 'testDmiBasePath/dmi/v1/ch/testCmHandle/modules'
+            def expectedHttpHeaders = new HttpHeaders()
+        when: 'get resource data is called to dmi'
+            objectUnderTest.getResourceFromDmiWithJsonData('testDmiBasePath',
+                    requestBody,
+                    'testCmHandle',
+                    'modules')
+        then: 'the post operation is executed with the correct URL and json data'
+            1 * mockDmiRestClient.postOperationWithJsonData(expectedUrl, requestBody, expectedHttpHeaders)
+    }
 }
\ No newline at end of file