patch operation for ncmp running
[cps.git] / csit / tests / ncmp-passthrough / ncmp-passthrough.robot
index 36350ad..1d977b9 100644 (file)
@@ -116,3 +116,24 @@ Verify delete to bookstore using passthrough-running removed only category 01
             Should Be Equal As Strings              "${item['name']}"  "Horror"
         END
     END
+
+Patch will add new category with new book and add a new book to an existing category
+    ${uri}=              Set Variable       ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore
+    ${headers}=          Create Dictionary  Content-Type=application/yang.patch+json   Authorization=${auth}
+    ${jsonData}=         Get Binary File    ${DATADIR}${/}bookstorePatchExample.json
+    ${response}=         PATCH On Session   CPS_URL   ${uri}   headers=${headers}   data=${jsonData}
+    Should Be Equal As Strings              ${response.status_code}   200
+    ${verifyUri}=       Set Variable        ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=100
+    ${verifyHeaders}=    Create Dictionary  Authorization=${auth}
+    ${verifyResponse}=   Get On Session     CPS_URL   ${verifyUri}   headers=${verifyHeaders}
+    ${responseJson}=    Set Variable        ${verifyResponse.json()}
+    Should Be Equal As Strings              ${verifyResponse.status_code}   200
+    FOR   ${item}   IN  @{responseJson['stores:categories']}
+        IF   "${item['code']}" == "100"
+            Should Be Equal As Strings              "${item['name']}"  "Category100"
+        END
+    END
+    ${verifyUri}=       Set Variable       ${ncmpBasePath}/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=02/books=A%20New%20book%20in%20existing%20category
+    ${verifyResponse}=  Get On Session     CPS_URL   ${verifyUri}   headers=${verifyHeaders}
+    ${responseJson}=    Set Variable       ${verifyResponse.json()}
+    Should Be Equal As Strings             ${verifyResponse.status_code}   200
\ No newline at end of file