From 91bc389c09cdda616886afb2f9b90739a5a94b18 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Wed, 23 Dec 2020 18:18:07 +0000 Subject: [PATCH 1/2] merge with develop branch --- .../Provision/Entities/CreateEntity/001.robot | 33 ++++++++++++ .../Provision/Entities/CreateEntity/002.robot | 22 ++++++++ .../Provision/Entities/CreateEntity/003.robot | 28 +++++++++++ .../Entities/CreateEntity/AlreadyExists.robot | 50 ------------------- .../SuccessCases-datadriven.robot | 41 --------------- .../Entities/CreateEntity/SuccessCases.robot | 44 ---------------- .../Provision/Entities/DeleteEntity/004.robot | 27 ++++++++++ .../Provision/Entities/testAPI.http | 35 +++++++++++++ resources/ApiUtils.resource | 7 +++ 9 files changed, 152 insertions(+), 135 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot delete mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot delete mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases-datadriven.robot delete mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot new file mode 100644 index 00000000..9ce9d5cf --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Check that you can create an entity +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Create Entity Scenarios + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Cases *** FILENAME CONTENT_TYPE +001_01_MinimalEntity building-minimal-without-context-sample.jsonld application/json +001_02_EntityWithSimpleProperties building-simple-attributes-sample.jsonld application/ld+json +001_03_EntityWithRelationshipsProperties building-relationship-of-property-sample.jsonld application/ld+json +#001_04_EntityWithNoContext building-minimal-without-context-sample.jsonld application/ld+json +001_05_EntityWithLocationAttribute building-location-attribute.jsonld application/ld+json + + + +*** Keywords *** +Create Entity Scenarios + [Arguments] ${filename} ${content_type} + [Documentation] Check that you can create an entity + [Tags] mandatory entityOperations + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + + Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} + Check Response Status Code Set To 201 + Check Response Headers Containing URI set to ${request['path']} ${entity_id} + + [Teardown] Delete Entity by Id ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot new file mode 100644 index 00000000..8885ef5d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot @@ -0,0 +1,22 @@ +*** Settings *** +Documentation Check that you cannot create an entity with an invalid request +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Entity With Invalid Request Scenarios + +*** Test Cases *** FILENAME PROBLEM_TYPE EXPECTED_CODE +002_01_InvalidJson invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} 406 +002_02_EmptyJson empty-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} 400 + +*** Keywords *** +Create Entity With Invalid Request Scenarios + [Arguments] ${filename} ${problem_type} ${expected_code} + [Documentation] Check that you cannot create an entity with an invalid request + [Tags] mandatory + + Request Entity From File ${filename} + + Check RL Response Status Code Set To Expected Code ${expected_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot new file mode 100644 index 00000000..973171d8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you cannot create an entity with and existing id +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${expected_error_message}= Already exists. +${filename}= building-minimal-sample.jsonld +${content_type}= application/ld+json + +*** Test Case *** +Create one valid entity and one invalid entity + [Documentation] Check that you cannot create an entity with and existing id + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} + Check Response Status Code Set To 201 + + #creating entity with the same id + Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} + Check Response Status Code Set To 409 + Check Response Body Details Containing Information Error ${expected_error_message} + + [Teardown] Delete Entity by Id ${entity_id} + diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot deleted file mode 100644 index ef8a8050..00000000 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robot +++ /dev/null @@ -1,50 +0,0 @@ -*** Settings *** -Documentation Check that the IUT refuses to create an entity if one exists with the same identifier -Variables ../../../../../../resources/variables.py -#Resource ../../../../../../resources/ApiUtils.resource -Library REST ${url} -Library JSONSchemaLibrary ${EXECDIR}/schemas -Library BuiltIn - -#Suite Setup Create Entity building-minimal.jsonld -#Suite Teardown Delete Entity by Id urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9 - -*** Variable *** -${endpoint}= entities - -*** Test Case *** -AlreadyExists - [Documentation] Check that the IUT refuses to create an entity if one exists with the same identifier - [Tags] mandatory - Create Entity building-minimal.jsonld - Create Entity building-minimal.jsonld - Check HTTP Status Code Is 409 - Check HTTP Response Body Json Schema Is error_response - Delete Entity by Id urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9 - -*** Keywords *** -Create Entity - [Arguments] ${filename} - &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${EXECDIR}/data/entities/${filename} headers=${headers} - Output request - Output response - Set Test Variable ${response} - -Check HTTP Status Code Is - [Arguments] ${status} - ${response_status}= convert to string ${response['status']} - Should Be Equal ${response_status} ${status} - -Check HTTP Response Body Json Schema Is - [Arguments] ${input} - Should Contain ${response['headers']['Content-Type']} application/json - ${schema}= Catenate SEPARATOR= ${input} .schema.json - Validate Json ${schema} ${response['body']} - Log Json Schema Validation OK - -Delete Entity by Id - [Arguments] ${id} - ${response}= DELETE ${endpoint}/${id} - Output request - Output response \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases-datadriven.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases-datadriven.robot deleted file mode 100644 index d4a31dd4..00000000 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases-datadriven.robot +++ /dev/null @@ -1,41 +0,0 @@ -*** Settings *** -Documentation Check that the IUT accepts the creation of an entity -Variables ../../../../../../resources/variables.py -Library REST ${url} -Library JSONSchemaLibrary ${EXECDIR}/schemas - -Test Template Create Entity Scenarios - -*** Variable *** -${endpoint}= entities -${id}= urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9 - -*** Test Cases *** FILENAME -SuccessCases_MinimalEntity building-minimal.jsonld -SuccessCases_EntityWithSimpleProperties building-simple-attributes.jsonld - -*** Keywords *** -Create Entity Scenarios - [Arguments] ${filename} - Create Entity ${filename} - Check HTTP Status Code Is 201 - Delete Entity by Id ${id} - -Create Entity - [Arguments] ${filename} - &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${EXECDIR}/data/entities/${filename} headers=${headers} - Output request - Output response - Set Test Variable ${response} - -Check HTTP Status Code Is - [Arguments] ${status} - ${response_status}= convert to string ${response['status']} - Should Be Equal ${response_status} ${status} - -Delete Entity by Id - [Arguments] ${id} - ${response}= DELETE ${endpoint}/${id} - Output request - Output response \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot deleted file mode 100644 index 47474e20..00000000 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases.robot +++ /dev/null @@ -1,44 +0,0 @@ -*** Settings *** -Documentation Check that the IUT accepts the creation of an entity -Variables ../../../../../../resources/variables.py -#Resource ../../../../../../resources/ApiUtils.resource -Library REST ${url} - -*** Variable *** -${endpoint}= entities -${id}= urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9 - -*** Test Case *** -SuccessCases_MinimalEntity - [Documentation] Create an entity with a JSON-LD payload containing the minimal information - [Tags] mandatory - Create Entity building-minimal.jsonld - Check HTTP Status Code Is 201 - Delete Entity by Id ${id} - -SuccessCases_EntityWithSimpleProperties - [Documentation] Create an entity with a JSON-LD payload containing only simple properties - Create Entity building-simple-attributes.jsonld - Check HTTP Status Code Is 201 - Delete Entity by Id ${id} - - -*** Keywords *** -Create Entity - [Arguments] ${filename} - &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${EXECDIR}/data/entities/${filename} headers=${headers} - Output request - Output response - Set Test Variable ${response} - -Check HTTP Status Code Is - [Arguments] ${status} - ${response_status}= convert to string ${response['status']} - Should Be Equal ${response_status} ${status} - -Delete Entity by Id - [Arguments] ${id} - ${response}= DELETE ${endpoint}/${id} - Output request - Output response diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot new file mode 100644 index 00000000..39812bd9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you can delete an entity by id +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +#Suite Setup Setup Initial Entity + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Delete an entity + [Documentation] Check that you can delete an entity by id + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type building-simple-attributes-sample.jsonld ${entity_id} application/ld+json + + ${response}= Delete Entity by Id Returning Response ${entity_id} + Should Be Equal 204 ${response['status']} + +#*** Keywords *** +#Setup Initial Entity +# ${entity_id}= Generate Random Entity Id ${building_id_prefix} +# Create Entity building-simple-attributes-sample.jsonld ${entity_id} +# Set Suite Variable ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http b/TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http new file mode 100644 index 00000000..dd7fb4e4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http @@ -0,0 +1,35 @@ +POST http://localhost:9090/ngsi-ld/v1/entities/ +Content-Type: application/ld+json + +{ + "id": "urn:ngsi-ld:Building:0163037144675563", + "type": "Building", + "@context": [ + "https://fiware.github.io/data-models/context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} + +### +DELETE http://localhost:9090/ngsi-ld/v1/entities/urn:ngsi-ld:Building:0163037144675563 + +### + +POST http://localhost:9090/ngsi-ld/v1/entities/ +Content-Type: application/ld+json + +{ + "id": "urn:ngsi-ld:Building:0163037144675563",, + "type": "Building", + "@context": [ + "https://fiware.github.io/data-models/context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} + +### +POST http://localhost:9090/ngsi-ld/v1/entities/ +Content-Type: application/ld+json + +{ +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 50407fe7..b7317b08 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -50,6 +50,13 @@ Api DEL request Output Schema Set Test Variable ${response} +Delete Entity by Id Returning Response + [Arguments] ${id} + ${response}= DELETE ${ENTITIES_ENDPOINT_PATH}/${id} + Output request + Output response + [return] ${response} + Delete Entity by Id [Arguments] ${id} ${response}= DELETE ${ENTITIES_ENDPOINT_PATH}/${id} -- GitLab From 1bb9964d51e733b62473d6b0b35e2979b43aaa19 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 28 Dec 2020 15:23:14 +0000 Subject: [PATCH 2/2] added /provision/entities/deleteEntity/*.robot and refactores some keywords and previous tests --- .../Provision/Entities/CreateEntity/001.robot | 6 ++-- .../Provision/Entities/CreateEntity/003.robot | 11 +++--- .../Provision/Entities/DeleteEntity/004.robot | 15 +++----- .../Provision/Entities/DeleteEntity/005.robot | 28 +++++++++++++++ .../Provision/Entities/DeleteEntity/006.robot | 21 +++++++++++ .../Provision/Entities/testAPI.http | 35 ------------------- resources/ApiUtils.resource | 8 ++--- resources/AssertionUtils.resource | 8 +++-- resources/variables.py | 2 +- 9 files changed, 73 insertions(+), 61 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/005.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/006.robot delete mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot index 9ce9d5cf..721c3d99 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot @@ -26,8 +26,8 @@ Create Entity Scenarios ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} - Check Response Status Code Set To 201 - Check Response Headers Containing URI set to ${request['path']} ${entity_id} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} + Check Response Status Code 201 ${response['status']} + Check Response Headers Containing URI set to ${request['path']} ${entity_id} ${response} [Teardown] Delete Entity by Id ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot index 973171d8..bf0050cc 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot @@ -16,13 +16,14 @@ Create one valid entity and one invalid entity [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} - Check Response Status Code Set To 201 + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} + Check Response Status Code 201 ${response['status']} #creating entity with the same id - Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} - Check Response Status Code Set To 409 - Check Response Body Details Containing Information Error ${expected_error_message} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${content_type} + Check Response Status Code 409 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_ALREADY_EXISTS} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} [Teardown] Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot index 39812bd9..ca6c0422 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/004.robot @@ -4,24 +4,17 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -#Suite Setup Setup Initial Entity - *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Case *** -Delete an entity +004_Delete an entity [Documentation] Check that you can delete an entity by id [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type building-simple-attributes-sample.jsonld ${entity_id} application/ld+json + ${request} ${response}= Create Entity Selecting Content Type building-simple-attributes-sample.jsonld ${entity_id} application/ld+json + Check Response Status Code 201 ${response['status']} ${response}= Delete Entity by Id Returning Response ${entity_id} - Should Be Equal 204 ${response['status']} - -#*** Keywords *** -#Setup Initial Entity -# ${entity_id}= Generate Random Entity Id ${building_id_prefix} -# Create Entity building-simple-attributes-sample.jsonld ${entity_id} -# Set Suite Variable ${entity_id} + Check Response Status Code 204 ${response['status']} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/005.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/005.robot new file mode 100644 index 00000000..1e23d929 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/005.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you cannot delete an entity with invalid/missing id +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Delete Entity Scenarios + +*** Variable *** +${entity_id_empty}= +${entity_id_not_valid}= thisisaninvaliduri + +*** Test Cases *** ENTITY_ID EXPECTED_STATUS_CODE PROBLEM_TYPE +005_01_Delete an entity if the Entity Id is not present ${entity_id_empty} 400 ${ERROR_TYPE_BAD_REQUEST_DATA} +005_02_Delete an entity if the Entity Id is not a valid URI ${entity_id_not_valid} 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + + +*** Keywords *** +Delete Entity Scenarios + [Arguments] ${entity_id} ${expected_status_code} ${problem_type} + [Documentation] Check that you cannot delete an entity with invalid/missing id + [Tags] mandatory failing + + ${response}= Delete Entity by Id Returning Response ${entity_id} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/006.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/006.robot new file mode 100644 index 00000000..b71875cf --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/006.robot @@ -0,0 +1,21 @@ +*** Settings *** +Documentation Check that you cannot delete an entity if the entity id is not known to the system +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${expected_status_code}= 404 + +*** Test Case *** +006_Delete an entity with an id not known to the system + [Documentation] Check that you cannot delete an entity if the entity id is not known to the system + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + + ${response}= Delete Entity by Id Returning Response ${entity_id} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http b/TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http deleted file mode 100644 index dd7fb4e4..00000000 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/testAPI.http +++ /dev/null @@ -1,35 +0,0 @@ -POST http://localhost:9090/ngsi-ld/v1/entities/ -Content-Type: application/ld+json - -{ - "id": "urn:ngsi-ld:Building:0163037144675563", - "type": "Building", - "@context": [ - "https://fiware.github.io/data-models/context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" - ] -} - -### -DELETE http://localhost:9090/ngsi-ld/v1/entities/urn:ngsi-ld:Building:0163037144675563 - -### - -POST http://localhost:9090/ngsi-ld/v1/entities/ -Content-Type: application/ld+json - -{ - "id": "urn:ngsi-ld:Building:0163037144675563",, - "type": "Building", - "@context": [ - "https://fiware.github.io/data-models/context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" - ] -} - -### -POST http://localhost:9090/ngsi-ld/v1/entities/ -Content-Type: application/ld+json - -{ -} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 2341bac4..cf0f717f 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -21,7 +21,8 @@ ${CONTENT_TYPE_LD_JSON} application/ld+json ${ERROR_TYPE_BAD_REQUEST_DATA} http://uri.etsi.org/ngsi-ld/errors/BadRequestData ${ERROR_TYPE_INVALID_REQUEST} http://uri.etsi.org/ngsi-ld/errors/InvalidRequest -${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound +${ERROR_TYPE_RESOURCE_NOT_FOUND} http://uri.etsi.org/ngsi-ld/errors/ResourceNotFound +${ERROR_TYPE_ALREADY_EXISTS} http://uri.etsi.org/ngsi-ld/errors/AlreadyExists ${response} @@ -52,7 +53,7 @@ Api DEL request Delete Entity by Id Returning Response [Arguments] ${id} - ${response}= DELETE ${ENTITIES_ENDPOINT_PATH}/${id} + ${response}= DELETE ${ENTITIES_ENDPOINT_PATH}${id} Output request Output response [return] ${response} @@ -82,9 +83,8 @@ Create Entity Selecting Content Type ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} Output request Output response - Set Test Variable ${response} ${request}= Output request - Set Test Variable ${request} + [return] ${request} ${response} Create Entity [Arguments] ${filename} ${entity_id} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 52d19507..a648ed4e 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -5,6 +5,11 @@ Library ${EXECDIR}/libraries/assertionUtils.py ${instance_id_regex_expr}= root\\[.*\\]\\['instanceId'\\] *** Keywords *** +Check Response Status Code + [Arguments] ${expected_status_code} ${response_status_code} + ${response_status_code}= convert to string ${response_status_code} + Should Be Equal ${expected_status_code} ${response_status_code} + Check Response Status Code Set To [Arguments] ${expected_status} ${response_status}= convert to string ${response['status']} @@ -23,8 +28,7 @@ Check Response Body Containing Array Of URIs set to Lists Should Be Equal ${expected_entities_ids} ${response['body']} ignore_order=True Check Response Headers Containing URI set to -# upon success, the http response shall include a loication http header that countains the uri of the created entity resource - [Arguments] ${expected_path} ${expected_entity_id} + [Arguments] ${expected_path} ${expected_entity_id} ${response} Should Be Equal ${expected_path}${expected_entity_id} ${response['headers']['location']} ignore_order=True Check Response Body Containing an Attribute set to diff --git a/resources/variables.py b/resources/variables.py index 88e1f536..3b9e617a 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -1,6 +1,6 @@ def get_variables(arg=None): variables = { - 'url': 'http://localhost:9090/ngsi-ld/v1', + 'url': 'https://broker-ngsi-ld.demeter.ubiwhere.com/ngsi-ld/v1', 'ngsild_test_suite_context': 'https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld' } return variables -- GitLab