Commit 76e35065 authored by lopesg's avatar lopesg
Browse files

added append, update entity attributes and partial update entity attributes suites

parent 1f32b124
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -13,16 +13,14 @@ ${building_id_prefix}= urn:ngsi-ld:Building:
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_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
    [Tags]  mandatory

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}

+7 −6
Original line number Diff line number Diff line
@@ -5,18 +5,19 @@ 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
*** Test Cases ***                        FILENAME                         
002_01_InvalidJson                        invalid-json-sample.jsonld            
002_02_EmptyJson                          empty-sample.jsonld
002_03_EntityWithNoContext                building-minimal-without-context-sample.jsonld      

*** Keywords ***
Create Entity With Invalid Request Scenarios
    [Arguments]  ${filename}    ${problem_type}    ${expected_code}
    [Arguments]  ${filename}
    [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 Status Code Set To Expected Code    400
    Check RL Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check RL Response Body Containing ProblemDetails Element Containing Title Element    ${response}
 No newline at end of file
+2 −3
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot create an entity with and existing id
Documentation   Check that you cannot create an entity with an existing id
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource
@@ -11,14 +11,13 @@ ${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
    [Documentation]  Check that you cannot create an entity with an existing id
    [Tags]  mandatory

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${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
    ${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}
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ ${entity_id_not_valid}= thisisaninvaliduri
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
    [Tags]  mandatory

    ${response}=    Delete Entity by Id Returning Response   ${entity_id}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
+7 −6
Original line number Diff line number Diff line
@@ -8,16 +8,17 @@ Test Template Append Attributes

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${filename}=  vehicle-datasetid-attributes-sample.jsonld

*** Test Cases ***                    STATUS_CODE      OVERWRITE           FILENAME                                           FRAGMENT_FILENAME                                         EXPECTATION_FILENAME
001_01_Append entity attributes       204              ${EMPTY}            vehicle-datasetid-attributes-sample.jsonld         vehicle-fragment-same-datasetid-sample.jsonld             vehicle-attributes-sample-append-expectation-01.jsonld
001_02_Append entity attributes       207              noOverwrite         vehicle-datasetid-attributes-sample.jsonld         vehicle-fragment-same-datasetid-sample.jsonld             vehicle-attributes-sample-append-expectation-02.jsonld
001_03_Append entity attributes       204              ${EMPTY}            vehicle-datasetid-attributes-sample.jsonld         vehicle-fragment-different-datasetid-sample.jsonld        vehicle-attributes-sample-append-expectation-03-04.jsonld
001_04_Append entity attributes       204              noOverwrite         vehicle-datasetid-attributes-sample.jsonld         vehicle-fragment-different-datasetid-sample.jsonld        vehicle-attributes-sample-append-expectation-03-04.jsonld
*** Test Cases ***                    STATUS_CODE      OVERWRITE           FRAGMENT_FILENAME                                         EXPECTATION_FILENAME
001_01_Append entity attributes       204              ${EMPTY}            vehicle-fragment-same-datasetid-sample.jsonld             vehicle-attributes-sample-append-expectation-01.jsonld
001_02_Append entity attributes       207              noOverwrite         vehicle-fragment-same-datasetid-sample.jsonld             vehicle-attributes-sample-append-expectation-02.jsonld
001_03_Append entity attributes       204              ${EMPTY}            vehicle-fragment-different-datasetid-sample.jsonld        vehicle-attributes-sample-append-expectation-03-04.jsonld
001_04_Append entity attributes       204              noOverwrite         vehicle-fragment-different-datasetid-sample.jsonld        vehicle-attributes-sample-append-expectation-03-04.jsonld

*** Keywords ***
Append Attributes
    [Arguments]  ${status_code}    ${overwrite}    ${filename}    ${fragment_filename}    ${expectation_filename}
    [Arguments]  ${status_code}    ${overwrite}   ${fragment_filename}    ${expectation_filename}
    [Documentation]  Check that you can append entity attributes
    [Tags]  mandatory  failing

Loading