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

Merge branch 'feature/implement-missing-validations' into 'develop'

Feature/implement missing validations

See merge request !53
parents 1f9fa4a4 16b10d87
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -10,17 +10,17 @@ ${filename}= vehicle-speed-two-datasetid-sample.jsonld

*** Test Cases ***
010_01_01_Append entity attributes       
    Append Attributes Without Params  204   vehicle-new-attribute-fragment.jsonld
    Append Attributes Without Params  204   vehicle-new-attribute-fragment.jsonld   vehicle-speed-appended-expectation.jsonld
010_01_02_Append entity attributes
    Append Attributes With Params  207    vehicle-attribute-to-add-fragment.jsonld    add-attribute-expectation.jsonld
    Append Attributes With Params  207    vehicle-attribute-to-add-fragment.jsonld    add-attribute-expectation.jsonld    vehicle-speed-appended-expectation.jsonld
010_01_03_Append entity attributes
    Append Attributes Without Params  204    vehicle-speed-different-datasetid-fragment.jsonld
    Append Attributes Without Params  204    vehicle-speed-different-datasetid-fragment.jsonld    vehicle-speed-different-datasetid-expectation.jsonld
010_01_04_Append entity attributes
    Append Attributes With Params  204    vehicle-speed-different-datasetid-fragment.jsonld    ${EMPTY}
    Append Attributes With Params  204    vehicle-speed-different-datasetid-fragment.jsonld    ${EMPTY}    vehicle-speed-different-datasetid-expectation.jsonld

*** Keywords ***
Append Attributes Without Params
    [Arguments]  ${status_code}    ${fragment_filename}
    [Arguments]  ${status_code}    ${fragment_filename}    ${expectation_filename}
    [Documentation]  Check that you can append entity attributes
    [Tags]  /entities/{entityId}/attrs/      5_6_3

@@ -31,10 +31,15 @@ Append Attributes Without Params
    ${response}=    Append Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  ${status_code}    ${response['status']}

    ${entity_expectation_payload}=    Load Test Sample   entities/expectations/${expectation_filename}    ${entity_id}
    Retrieve Entity by Id   ${entity_id}   context=${ngsild_test_suite_context}   accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=  Create List    ${status_regex_expr}
    Check Updated Resource Set To     ${entity_expectation_payload}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}

Append Attributes With Params
    [Arguments]  ${status_code}    ${fragment_filename}    ${expectation_filename}
    [Arguments]  ${status_code}    ${fragment_filename}    ${expectation_response_body}    ${expectation_filename}
    [Documentation]  Check that you can append entity attributes
    [Tags]  /entities/{entityId}/attrs/      5_6_3

@@ -44,6 +49,11 @@ Append Attributes With Params

    ${response}=    Append Entity Attributes With Parameters    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}    noOverwrite
    Check Response Status Code  ${status_code}    ${response['status']}
    Run Keyword If    "${expectation_filename}"!="${EMPTY}"    Check Response Body Content    ${expectation_filename}    ${response['body']}
    Run Keyword If    "${expectation_response_body}"!="${EMPTY}"    Check Response Body Content    ${expectation_response_body}    ${response['body']}

    ${entity_expectation_payload}=    Load Test Sample   entities/expectations/${expectation_filename}    ${entity_id}
    Retrieve Entity by Id   ${entity_id}   context=${ngsild_test_suite_context}   accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=  Create List    ${status_regex_expr}    @context
    Check Updated Resource Set To     ${entity_expectation_payload}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+12 −7
Original line number Diff line number Diff line
@@ -10,15 +10,15 @@ Test Template Update Attributes
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${filename}=  vehicle-two-datasetid-attributes-sample.jsonld

*** Test Cases ***                                                                   STATUS_CODE               FRAGMENT_FILENAME                                        EXPECTATION_FILENAME
011_01_01_Check that you can update existing attributes with no datasetId            204                       vehicle-speed-two-datasetid-01-fragment.jsonld        ${EMPTY}
011_01_02_Check that you can update existing attributes with the datasetId           204                       vehicle-speed-two-datasetid-02-fragment.jsonld        ${EMPTY}
011_01_03_Check that you can update only some attributes while others failed         207                       vehicle-speed-two-datasetid-03-fragment.jsonld        vehicle-speed-datasetid-expectation.jsonld
011_01_04_Check that you cannot change the type of the attribute                     204                       vehicle-speed-two-datasetid-04-fragment.jsonld        ${EMPTY}
*** Test Cases ***                                                                   STATUS_CODE               FRAGMENT_FILENAME                                     EXPECTATION_RESPONSE_FILENAME                        EXPECTATION_FILENAME
011_01_01_Check that you can update existing attributes with no datasetId            204                       fragments/vehicle-speed-two-datasetid-01-fragment.jsonld        ${EMPTY}                                             expectations/vehicle-update-attributes-expectation.jsonld
011_01_02_Check that you can update existing attributes with the datasetId           204                       vehicle-speed-two-datasetid-02-fragment.jsonld        ${EMPTY}                                             expectations/vehicle-update-datasetid-attributes-expectation.jsonld
011_01_03_Check that you can update only some attributes while others failed         207                       vehicle-speed-two-datasetid-03-fragment.jsonld        vehicle-speed-datasetid-expectation.jsonld           expectations/vehicle-multi-attributes-expectation.jsonld
011_01_04_Check that you cannot change the type of the attribute                     204                       vehicle-speed-two-datasetid-04-fragment.jsonld        ${EMPTY}                                             vehicle-two-datasetid-attributes-sample.jsonld

*** Keywords ***
Update Attributes
    [Arguments]  ${status_code}    ${fragment_filename}    ${expectation_filename}
    [Arguments]  ${status_code}    ${fragment_filename}    ${expectation_response_filename}    ${expectation_filename}
    [Documentation]  Check that you can update entity attributes
    [Tags]  /entities/{entityId}/attrs/      5_6_2

@@ -28,6 +28,11 @@ Update Attributes

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  ${status_code}    ${response['status']}
    Run Keyword If    "${expectation_filename}"!="${EMPTY}"    Check Response Body Content    ${expectation_filename}    ${response['body']}
    Run Keyword If    "${expectation_response_filename}"!="${EMPTY}"    Check Response Body Content    ${expectation_response_filename}    ${response['body']}

    ${entity_expectation_payload}=    Load Test Sample   entities/${expectation_filename}    ${entity_id}
    Retrieve Entity by Id   ${entity_id}   context=${ngsild_test_suite_context}   accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=  Create List    ${status_regex_expr}    @context
    Check Updated Resource Set To     ${entity_expectation_payload}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+10 −4
Original line number Diff line number Diff line
@@ -11,13 +11,13 @@ ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle:
${filename}=  vehicle-speed-two-datasetid-sample.jsonld
${status_code}=  204

*** Test Cases ***                                                                           FRAGMENT_FILENAME                                        ATTRIBUTE_ID             
012_01_01_Check that you can partially update an attribute                                   vehicle-isparked-fragment.jsonld                         isParked                
012_01_02_Check that you can partially update an attribute by specifying the datasetId       vehicle-speed-equal-datasetid-fragment.jsonld            speed                                      
*** Test Cases ***                                                                           FRAGMENT_FILENAME                                        ATTRIBUTE_ID      EXPECTATION_FILENAME       
012_01_01_Check that you can partially update an attribute                                   vehicle-isparked-fragment.jsonld                         isParked          vehicle-isparked-update-expectation.jsonld      
012_01_02_Check that you can partially update an attribute by specifying the datasetId       vehicle-speed-equal-datasetid-fragment.jsonld            speed              vehicle-update-speed-expectation.jsonld                      

*** Keywords ***
Update Attributes
    [Arguments]  ${fragment_filename}    ${attribute_id}
    [Arguments]  ${fragment_filename}    ${attribute_id}    ${expectation_filename}
    [Documentation]  Check that you can perform a partial update on an entity attribute
    [Tags]  /entities/{entityId}/attrs/{attrId}      5_6_4

@@ -28,4 +28,10 @@ Update Attributes
    ${response}=    Partial Update Entity Attributes    ${entity_id}    ${attribute_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  ${status_code}    ${response['status']}

    ${entity_expectation_payload}=    Load Test Sample   entities/expectations/${expectation_filename}    ${entity_id}
    Retrieve Entity by Id   ${entity_id}   context=${ngsild_test_suite_context}   accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=  Create List    ${status_regex_expr}    @context
    Check Updated Resource Set To     ${entity_expectation_payload}


    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+10 −5
Original line number Diff line number Diff line
@@ -12,14 +12,14 @@ ${status_code}= 204
${filename}=  vehicle-two-datasetid-attributes-sample.jsonld
${attribute_id}=  speed

*** Test Cases ***                                                        DATASETID                                   DELETEALL 
013_01_01_delete an attribute with the id                                 ${EMPTY}                                    false  
013_01_02_delete an attribute with the datasetId                          urn:ngsi-ld:Property:gpsBxyz123-speed       false 
013_01_03_delete all target attribute instances with a datasetId          urn:ngsi-ld:Property:gpsBxyz123-speed       true   
*** Test Cases ***                                                        DATASETID                                   DELETEALL       EXPECTATION_FILENAME
013_01_01_delete an attribute with the id                                 ${EMPTY}                                    false           vehicle-delete-default-speed-expectation.jsonld
013_01_02_delete an attribute with the datasetId                          urn:ngsi-ld:Property:gpsBxyz123-speed       false           vehicle-delete-datasetid-speed-expectation.jsonld
013_01_03_delete all target attribute instances with a datasetId          urn:ngsi-ld:Property:gpsBxyz123-speed       true            vehicle-delete-deleteall-speed-expectation.jsonld

*** Keywords ***
Delete Attributes
    [Arguments]  ${datasetId}    ${deleteAll}
    [Arguments]  ${datasetId}    ${deleteAll}    ${expectation_filename}
    [Documentation]  Check that you can delete an attribute from an entity
    [Tags]  /entities/{entityId}/attrs/{attrId}      5_6_5

@@ -30,4 +30,9 @@ Delete Attributes
    ${response}=    Delete Entity Attributes    ${entity_id}    ${attribute_id}    ${datasetId}    ${deleteAll}
    Check Response Status Code  ${status_code}    ${response['status']}

    ${entity_expectation_payload}=    Load Test Sample   entities/expectations/${expectation_filename}    ${entity_id}
    Retrieve Entity by Id   ${entity_id}   context=${ngsild_test_suite_context}   accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=  Create List    ${status_regex_expr}    @context
    Check Updated Resource Set To     ${entity_expectation_payload}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -23,4 +23,8 @@ Create Temporal Entity
    ${response}=  Create Or Update Temporal Representation Of Entity Selecting Content Type  ${temporal_entity_representation_id}    ${filename}     ${content_type}
    Check Response Status Code  201    ${response['status']}

    ${created_temporal_entity}=    Load Test Sample    temporalEntities/${filename}      ${temporal_entity_representation_id}
    Set Test Variable  ${response}
    Check Created Resource Set To     ${created_temporal_entity}

    [Teardown]    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
 No newline at end of file
Loading