Loading TP/NGSI-LD/JSON-LD@contextServer/Consumption/ServeContext/053_02.robot +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ ${reason_204}= No Content *** Test Cases *** DETAILS 053_02_01 Serve a @context with details equal to False [Tags] ctx-serve 5_13_4 ${False} false *** Keywords *** Loading TP/NGSI-LD/JSON-LD@contextServer/Consumption/ServeContext/053_03.robot +14 −14 Original line number Diff line number Diff line Loading @@ -16,12 +16,13 @@ Test Template Serve a @context with details equal to true ${filename}= @context-minimal-valid.json ${reason_200}= OK ${reason_204}= No Content ${context_hosted}= hosted *** Test Cases *** DETAILS *** Test Cases *** DETAILS CONTEXT_TYPE 053_02_01 Serve a @context with details equal to True [Tags] ctx-serve 5_13_4 ${True} true ${context_hosted} *** Keywords *** Loading @@ -33,7 +34,7 @@ Create Initial @context Serve a @context with details equal to true [Documentation] Check that you can serve a @context with details [Arguments] ${details} [Arguments] ${details} ${context_type} ${response}= Serve a @context ${uri} ${details} Loading @@ -41,14 +42,13 @@ Serve a @context with details equal to true Check Response Reason set to ${response.reason} ${reason_200} Check Response Headers Containing Content-Type set to ${CONTENT_TYPE_JSON} ${response.headers} # URL; # localId; # kind; # timestamp; # lastUsage [OPTIONAL]; # numberOfHits [OPTIONAL]; # extraInfo [OPTIONAL, used by implementations to report any kind of custom information]. Check Context Response Body Containing Detailed Information ${response.json()} # Check mandatory keys in the response (URL, localId, kind, timestamp) and their possible values Check Context Response Body Containing Detailed Information ${response.json()} ${context_type} # Check optional keys in the response (lastUsage, numberOfHits, extraInfo) and their possible values Check Dictionary Might Contain Additional Members ${response.json()} lastUsage Check Dictionary Might Contain Additional Members ${response.json()} numberOfHits Check Dictionary Might Contain Additional Members ${response.json()} extraInfo Delete Initial @context ${response_delete}= Delete a @context without reload ${uri} Loading TP/NGSI-LD/JSON-LD@contextServer/Provision/DeleteContext/051_01.robot +36 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you can delete a previous created hosted @context without reload param Resource ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource Library Collections Test Setup Create Initial hosted @context *** Variables *** ${filename}= @context-minimal-valid.json ${reason_204}= No Content ${context_hosted}= hosted *** Test Cases *** DETAILS CONTEXT_TYPE 051_01_01 Delete a @context whose kind is hosted without reload param [Documentation] Check that you can delete a hosted @context [Tags] ctx-serve 5_13_4 ${response}= Delete a @context without reload ${uri} Check Response Status Code 204 ${response.status_code} Check Response Reason set to ${response.reason} ${reason_204} Check Response Does Not Contain Body ${response} *** Keywords *** Create Initial hosted @context ${response}= Add a new @context ${filename} Check Response Status Code 201 ${response.status_code} ${uri}= Fetch Id From Response Location Header ${response.headers} Set Suite Variable ${uri} TP/NGSI-LD/JSON-LD@contextServer/Provision/DeleteContext/051_02.robot 0 → 100644 +27 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you get an error when trying to delete an unknown @context identifier Resource ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource Library Collections *** Variables *** ${filename}= @context-minimal-valid.json ${reason_404}= Not Found *** Test Cases *** 051_02_01 Delete a @context whose kind is hosted without reload param and unknown @context identifier [Documentation] Check that an error message is obtained in the response when we try to delete a @context without unknonwn id [Tags] ctx-serve 5_13_4 ${random_url}= Generate Random String 16 [NUMBERS] ${response}= Delete a @context without reload ${random_url} Check Response Status Code 404 ${response.status_code} Check Response Reason set to ${response.reason} ${reason_404} Check Response Body Containing ProblemDetails Element ${response.json()} ${ERROR_TYPE_RESOURCE_NOT_FOUND} resources/ApiUtils/JSON-LD@ContextServer.resource +13 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ ${CONTENT_TYPE_JSON} application/json ${response} ${EMPTY} @{ALLOWED_CONTEXT} Cached Hosted ImplicitlyCreated UserCreated *** Keywords *** Add a new @context Loading Loading @@ -55,8 +57,6 @@ Delete a @context without reload ... url=${url}/${JSONLDCONTEXTS_ENDPOINT_PATH}/${contextId} ... expected_status=any Status Should Be 204 ${response} Output ${response} Delete a @context without reload RETURN ${response} Loading @@ -70,8 +70,6 @@ Delete a @context with reload ... url=${url}/${JSONLDCONTEXTS_ENDPOINT_PATH}/${contextId}?${params} ... expected_status=any Status Should Be 204 ${response} Output ${response} Delete a @context with reload RETURN ${response} Loading @@ -81,16 +79,23 @@ Check Context Response Body Content Dictionaries Should Be Equal ${response_body} ${context_payload} Check Context Response Body Containing Detailed Information [Arguments] ${response_body} Should Not Be Empty ${response_body['url']} [Arguments] ${response_body} ${context_type} Should Not Be Empty ${response_body['URL']} Should Not Be Empty ${response_body['localId']} Should Not Be Empty ${response_body['kind']} Should Not Be Empty ${response_body['timestamp']} Should Be String ${response_body['url']} Should Be String ${response_body['URL']} Should Be String ${response_body['localId']} Should Be String ${response_body['kind']} IF $response_body['kind'] not in $ALLOWED_CONTEXT fail The value of kind:"${response_body['kind']}" is not allowed END Should Be Equal ${response_body['kind']} ${context_type} # TODO: v1.8.1 change timestamp -> createdAt Should Not Be Empty ${response_body['timestamp']} ${value}= Evaluate response_body.get('timestamp') ${date}= Parse Ngsild Date ${response_body}['timestamp'] Should Not Be Equal Loading Loading
TP/NGSI-LD/JSON-LD@contextServer/Consumption/ServeContext/053_02.robot +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ ${reason_204}= No Content *** Test Cases *** DETAILS 053_02_01 Serve a @context with details equal to False [Tags] ctx-serve 5_13_4 ${False} false *** Keywords *** Loading
TP/NGSI-LD/JSON-LD@contextServer/Consumption/ServeContext/053_03.robot +14 −14 Original line number Diff line number Diff line Loading @@ -16,12 +16,13 @@ Test Template Serve a @context with details equal to true ${filename}= @context-minimal-valid.json ${reason_200}= OK ${reason_204}= No Content ${context_hosted}= hosted *** Test Cases *** DETAILS *** Test Cases *** DETAILS CONTEXT_TYPE 053_02_01 Serve a @context with details equal to True [Tags] ctx-serve 5_13_4 ${True} true ${context_hosted} *** Keywords *** Loading @@ -33,7 +34,7 @@ Create Initial @context Serve a @context with details equal to true [Documentation] Check that you can serve a @context with details [Arguments] ${details} [Arguments] ${details} ${context_type} ${response}= Serve a @context ${uri} ${details} Loading @@ -41,14 +42,13 @@ Serve a @context with details equal to true Check Response Reason set to ${response.reason} ${reason_200} Check Response Headers Containing Content-Type set to ${CONTENT_TYPE_JSON} ${response.headers} # URL; # localId; # kind; # timestamp; # lastUsage [OPTIONAL]; # numberOfHits [OPTIONAL]; # extraInfo [OPTIONAL, used by implementations to report any kind of custom information]. Check Context Response Body Containing Detailed Information ${response.json()} # Check mandatory keys in the response (URL, localId, kind, timestamp) and their possible values Check Context Response Body Containing Detailed Information ${response.json()} ${context_type} # Check optional keys in the response (lastUsage, numberOfHits, extraInfo) and their possible values Check Dictionary Might Contain Additional Members ${response.json()} lastUsage Check Dictionary Might Contain Additional Members ${response.json()} numberOfHits Check Dictionary Might Contain Additional Members ${response.json()} extraInfo Delete Initial @context ${response_delete}= Delete a @context without reload ${uri} Loading
TP/NGSI-LD/JSON-LD@contextServer/Provision/DeleteContext/051_01.robot +36 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you can delete a previous created hosted @context without reload param Resource ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource Library Collections Test Setup Create Initial hosted @context *** Variables *** ${filename}= @context-minimal-valid.json ${reason_204}= No Content ${context_hosted}= hosted *** Test Cases *** DETAILS CONTEXT_TYPE 051_01_01 Delete a @context whose kind is hosted without reload param [Documentation] Check that you can delete a hosted @context [Tags] ctx-serve 5_13_4 ${response}= Delete a @context without reload ${uri} Check Response Status Code 204 ${response.status_code} Check Response Reason set to ${response.reason} ${reason_204} Check Response Does Not Contain Body ${response} *** Keywords *** Create Initial hosted @context ${response}= Add a new @context ${filename} Check Response Status Code 201 ${response.status_code} ${uri}= Fetch Id From Response Location Header ${response.headers} Set Suite Variable ${uri}
TP/NGSI-LD/JSON-LD@contextServer/Provision/DeleteContext/051_02.robot 0 → 100644 +27 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you get an error when trying to delete an unknown @context identifier Resource ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource Library Collections *** Variables *** ${filename}= @context-minimal-valid.json ${reason_404}= Not Found *** Test Cases *** 051_02_01 Delete a @context whose kind is hosted without reload param and unknown @context identifier [Documentation] Check that an error message is obtained in the response when we try to delete a @context without unknonwn id [Tags] ctx-serve 5_13_4 ${random_url}= Generate Random String 16 [NUMBERS] ${response}= Delete a @context without reload ${random_url} Check Response Status Code 404 ${response.status_code} Check Response Reason set to ${response.reason} ${reason_404} Check Response Body Containing ProblemDetails Element ${response.json()} ${ERROR_TYPE_RESOURCE_NOT_FOUND}
resources/ApiUtils/JSON-LD@ContextServer.resource +13 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ ${CONTENT_TYPE_JSON} application/json ${response} ${EMPTY} @{ALLOWED_CONTEXT} Cached Hosted ImplicitlyCreated UserCreated *** Keywords *** Add a new @context Loading Loading @@ -55,8 +57,6 @@ Delete a @context without reload ... url=${url}/${JSONLDCONTEXTS_ENDPOINT_PATH}/${contextId} ... expected_status=any Status Should Be 204 ${response} Output ${response} Delete a @context without reload RETURN ${response} Loading @@ -70,8 +70,6 @@ Delete a @context with reload ... url=${url}/${JSONLDCONTEXTS_ENDPOINT_PATH}/${contextId}?${params} ... expected_status=any Status Should Be 204 ${response} Output ${response} Delete a @context with reload RETURN ${response} Loading @@ -81,16 +79,23 @@ Check Context Response Body Content Dictionaries Should Be Equal ${response_body} ${context_payload} Check Context Response Body Containing Detailed Information [Arguments] ${response_body} Should Not Be Empty ${response_body['url']} [Arguments] ${response_body} ${context_type} Should Not Be Empty ${response_body['URL']} Should Not Be Empty ${response_body['localId']} Should Not Be Empty ${response_body['kind']} Should Not Be Empty ${response_body['timestamp']} Should Be String ${response_body['url']} Should Be String ${response_body['URL']} Should Be String ${response_body['localId']} Should Be String ${response_body['kind']} IF $response_body['kind'] not in $ALLOWED_CONTEXT fail The value of kind:"${response_body['kind']}" is not allowed END Should Be Equal ${response_body['kind']} ${context_type} # TODO: v1.8.1 change timestamp -> createdAt Should Not Be Empty ${response_body['timestamp']} ${value}= Evaluate response_body.get('timestamp') ${date}= Parse Ngsild Date ${response_body}['timestamp'] Should Not Be Equal Loading