Commit 1de9a58b authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

tentative fix of issue #152

parent 20fc3a1b
Loading
Loading
Loading
Loading
+27 −1
Original line number Original line Diff line number Diff line
@@ -916,9 +916,18 @@ POST subscriptions
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/LccnSubscriptionRequest.json
    ${body}=    Get File    jsons/LccnSubscriptionRequest.json
    ${body}=    Replace String    ${body}    \${callback_uri}    ${callback_uri}
    ${body}=    Replace String    ${body}    \${callback_port}    ${callback_port}
    ${body}=    Replace String    ${body}    \${callback_endpoint}    ${callback_endpoint}
    Log  Creating mock request and response to handle GET operation on notification endpoint
    &{notification_request}=  Create Mock Request Matcher	GET  ${callback_endpoint}
    &{notification_response}=  Create Mock Response	status_code=204
    Log    Issue the subscription request
    Create Mock Expectation  ${notification_request}  ${notification_response}
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}    
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}    
	${outputResponse}=    Output    response
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
	Clear Requests    ${callback_endpoint}
	
	
POST subscriptions DUPLICATION
POST subscriptions DUPLICATION
    Log    Trying to create a subscription with an already created content
    Log    Trying to create a subscription with an already created content
@@ -927,9 +936,18 @@ POST subscriptions DUPLICATION
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/LccnSubscriptionRequest.json
    ${body}=    Get File    jsons/LccnSubscriptionRequest.json
    ${body}=    Replace String    ${body}    \${callback_uri}    ${callback_uri}
    ${body}=    Replace String    ${body}    \${callback_port}    ${callback_port}
    ${body}=    Replace String    ${body}    \${callback_endpoint}    ${callback_endpoint}
    Log  Creating mock request and response to handle GET operation on notification endpoint
    &{notification_request}=  Create Mock Request Matcher	GET  ${callback_endpoint}
    &{notification_response}=  Create Mock Response	status_code=204
    Log    Issue the subscription request
    Create Mock Expectation  ${notification_request}  ${notification_response}
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}    
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}    
	${outputResponse}=    Output    response
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
	Clear Requests    ${callback_endpoint}
	
	
POST subscriptions NO DUPLICATION
POST subscriptions NO DUPLICATION
    Log    Trying to create a subscription with an already created content
    Log    Trying to create a subscription with an already created content
@@ -938,10 +956,18 @@ POST subscriptions NO DUPLICATION
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/LccnSubscriptionRequest.json
    ${body}=    Get File    jsons/LccnSubscriptionRequest.json
    ${body}=    Replace String    ${body}    \${callback_uri}    ${callback_uri}
    ${body}=    Replace String    ${body}    \${callback_port}    ${callback_port}
    ${body}=    Replace String    ${body}    \${callback_endpoint}    ${callback_endpoint}
    Log  Creating mock request and response to handle GET operation on notification endpoint
    &{notification_request}=  Create Mock Request Matcher	GET  ${callback_endpoint}
    &{notification_response}=  Create Mock Response	status_code=204
    Log    Issue the subscription request
    Create Mock Expectation  ${notification_request}  ${notification_response}
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}    
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}    
	${outputResponse}=    Output    response
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
	
    Clear Requests    ${callback_endpoint}	


GET Subscriptions
GET Subscriptions
    Log    Get the list of active subscriptions
    Log    Get the list of active subscriptions
+3 −0
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Suite Setup    Create Sessions
Suite Teardown    Terminate All Processes    kill=true
Resource    environment/variables.txt 
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}     ssl_verify=false
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}     ssl_verify=false
Library    OperatingSystem
Library    OperatingSystem
Library    JSONLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Library    Process


*** Test Cases ***
*** Test Cases ***
POST Create a new subscription
POST Create a new subscription
+1 −1
Original line number Original line Diff line number Diff line
@@ -6,5 +6,5 @@
      ]
      ]
    }
    }
  },
  },
  "callbackUri": "http://127.0.0.1/subscribe"
  "callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
}
 No newline at end of file