Commit 430db3f6 authored by Patricia dos Santos Oliveira's avatar Patricia dos Santos Oliveira
Browse files

Merge branch 'feature/create-entities' into 'develop'

Feature/create entities

See merge request cim/ngsi-ld-test-suite!9
parents d1b9f0c1 ff84262f
Loading
Loading
Loading
Loading
+1
Changes for .gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
resources/__pycache__
results
*.pyc
*.http
 No newline at end of file
+33
Changes for TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001.robot: 33 added lines, 0 removed lines.
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
+22
Changes for TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/002.robot: 22 added lines, 0 removed lines.
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
+28
Changes for TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot: 28 added lines, 0 removed lines.
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}
−50

File deleted.

Loading