From aa04d0dc6c6d86a69380514b246b1ff31f2b6388 Mon Sep 17 00:00:00 2001
From: uihassan <najam.hassan@xflowresearch.com>
Date: Wed, 2 Sep 2020 09:26:57 +0500
Subject: [PATCH] missing and new test cases  added for subscription

---
 SOL002/VNFIndicator-API/Subscriptions.robot | 69 ++++++++++++++++++++-
 1 file changed, 67 insertions(+), 2 deletions(-)

diff --git a/SOL002/VNFIndicator-API/Subscriptions.robot b/SOL002/VNFIndicator-API/Subscriptions.robot
index fd458fbb..1d54a66d 100644
--- a/SOL002/VNFIndicator-API/Subscriptions.robot
+++ b/SOL002/VNFIndicator-API/Subscriptions.robot
@@ -139,8 +139,47 @@ GET VNF Indicators Subscriptions - Bad Request Response too Big
     ...    Post-Conditions: none
     Get VNF Indicators Subscriptions
     Check HTTP Response Status Code Is    400
-    Check HTTP Response Body Json Schema Is   ProblemDetails    
+    Check HTTP Response Body Json Schema Is   ProblemDetails   
+    
+POST Create a new Subscription - Unprocessable Entity
+    [Documentation]    Test ID: 6.3.2.4.11
+    ...    Test title: POST Create a new Subscription - Unprocessable Entity
+    ...    Test objective: The objective is to test that content type of the payload body is supported and the payload body of a request contains syntactically correct data but the data cannot be processed.
+    ...    re-conditions: none
+    ...    Reference: Clause 8.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
+    ...    Config ID: Config_prod_VE
+    ...    Applicability: none
+    ...    Post-Conditions: none
+    Send Post Request for VNF Indicator Subscription
+    Check HTTP Response Status Code Is    422
+    Check HTTP Response Body Json Schema Is  ProblemDetails
+ 
+Create new VNF indicator Subscription - DUPLICATION
+    [Documentation]    Test ID: 6.3.2.4.12
+    ...    Test title: POST Create a new subscription - DUPLICATION
+    ...    Test objective: The POST method creates a new subscription even if an existing subscription to same content exist
+    ...    Pre-conditions: none
+    ...    Reference: Clause 8.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
+    ...    Config ID: Config_prod_VE
+    ...    Applicability: SUT should support duplication of subscription creation
+    ...    Post-Conditions: in response header Location shall not be null
+    Post Create subscription - DUPLICATION
+    Check HTTP Response Status Code Is    201
+    Check HTTP Response Body Json Schema Is    VnfIndicatorSubscription
 
+Create new VNF indicator Subscription - NO-DUPLICATION
+    [Documentation]    Test ID: 6.3.2.4.13
+    ...    Test title: POST Create a new subscription - NO-DUPLICATION
+    ...    Test objective: The POST method creates a new subscription even if an existing subscription to same content exist
+    ...    Pre-conditions: none
+    ...    Reference: Clause 8.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
+    ...    Config ID: Config_prod_VE
+    ...    Applicability: SUT should not support duplication of subscription creation
+    ...    Post-Conditions: in response header Location shall not be null
+    Post Create subscription - NO-DUPLICATION
+    Check HTTP Response Status Code Is    303
+    Check Operation Occurrence Id
+ 
  *** Keywords ***
 Get VNF Indicators Subscriptions
     Log    Trying to get the list of subscriptions
@@ -265,4 +304,30 @@ Check Notification Endpoint
     
 Check LINK in Header
     ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
-    Should Not Be Empty    ${linkURL}
\ No newline at end of file
+    Should Not Be Empty    ${linkURL}
+    
+Post Create subscription - DUPLICATION
+    Log    Trying to create a subscription with an already created content
+    Pass Execution If    ${VNFM_CHECKS_NOTIF_ENDPOINT} == 0    VNFM is not permitting duplication. Skipping the test
+    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    ${body}=    Get File    jsons/subscriptions.json
+    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}		
+    ${outputResponse}=    Output    response
+	Set Global Variable    ${response}    ${outputResponse}		
+		
+Post Create subscription - NO-DUPLICATION	
+    Log    Trying to create a subscription with an already created content
+    Pass Execution If    ${VNFM_CHECKS_NOTIF_ENDPOINT} == 1    VNFM permits duplication. Skipping the test
+    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
+    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
+    ${body}=    Get File    jsons/subscriptions.json
+    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}
+    ${outputResponse}=    Output    response
+	Set Global Variable    ${response}    ${outputResponse}	
+	
+Check Operation Occurrence Id
+    ${vnfLcmOpOccId}=    Get Value From Json    ${response['headers']}    $..Location
+    Should Not Be Empty    ${vnfLcmOpOccId}
-- 
GitLab