Loading .gitignore +1 −0 Original line number Diff line number Diff line resources/__pycache__ results *.pyc *.http No newline at end of file TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot 0 → 100644 +33 −0 Original line number Diff line number Diff line *** 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 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot 0 → 100644 +22 −0 Original line number Diff line number Diff line *** 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 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot 0 → 100644 +28 −0 Original line number Diff line number Diff line *** 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} TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robotdeleted 100644 → 0 +0 −50 Original line number Diff line number Diff line *** 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 Loading
.gitignore +1 −0 Original line number Diff line number Diff line resources/__pycache__ results *.pyc *.http No newline at end of file
TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot 0 → 100644 +33 −0 Original line number Diff line number Diff line *** 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
TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot 0 → 100644 +22 −0 Original line number Diff line number Diff line *** 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
TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot 0 → 100644 +28 −0 Original line number Diff line number Diff line *** 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}
TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists.robotdeleted 100644 → 0 +0 −50 Original line number Diff line number Diff line *** 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