Commit 6dea8598 authored by lopesg's avatar lopesg
Browse files

fixed some tests

parent bb89d20b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -11,16 +11,16 @@ ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle:
${filename}=  vehicle-datasetid-attributes-sample.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_01_Append entity attributes       204              ${EMPTY}            vehicle-fragment-same-datasetid-sample.jsonld             ${EMPTY}
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
001_03_Append entity attributes       204              ${EMPTY}            vehicle-fragment-different-datasetid-sample.jsonld        ${EMPTY}
001_04_Append entity attributes       204              noOverwrite         vehicle-fragment-different-datasetid-sample.jsonld        ${EMPTY}

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

    ${entity_id}=     Generate Random Entity Id    ${vehicle_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_LD_JSON}
@@ -28,6 +28,6 @@ Append Attributes

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

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

*** Test Cases ***                                                                STATUS_CODE               FRAGMENT_FILENAME                                        EXPECTATION_FILENAME
004_01_Check that you can update existing attributes with no datasetId            204                       vehicle-two-datasetid-attributes-sample-01.jsonld        vehicle-two-datasetid-attributes-sample-expectation-01.jsonld
004_02_Check that you can update existing attributes with the datasetId           204                       vehicle-two-datasetid-attributes-sample-02.jsonld        vehicle-two-datasetid-attributes-sample-expectation-01.jsonld
004_01_Check that you can update existing attributes with no datasetId            204                       vehicle-two-datasetid-attributes-sample-01.jsonld        ${EMPTY}
004_02_Check that you can update existing attributes with the datasetId           204                       vehicle-two-datasetid-attributes-sample-02.jsonld        ${EMPTY}
004_03_Check that you can update only some attributes while others failed         207                       vehicle-two-datasetid-attributes-sample-03.jsonld        vehicle-two-datasetid-attributes-sample-expectation-03.jsonld
004_04_Check that you cannot change the type of the attribute                     204                       vehicle-two-datasetid-attributes-sample-04.jsonld        vehicle-two-datasetid-attributes-sample-expectation-04.jsonld
004_04_Check that you cannot change the type of the attribute                     204                       vehicle-two-datasetid-attributes-sample-04.jsonld        ${EMPTY}

*** Keywords ***
Update Attributes
@@ -28,6 +28,6 @@ Update Attributes

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

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+6 −6
Original line number Diff line number Diff line
@@ -4,21 +4,21 @@ Resource ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Test Template  Append Attributes
Test Template  Delete Attributes

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${status_code}=  204
${filename}=  vehicle-two-datasetid-attributes-sample.jsonld
${attribute_id}=  speed
${attribute_id}=  'https://uri.fiware.org/ns/data-models#speed'

*** Test Cases ***                                                     DATASETID                                    DELETEALL 
010_01_delete an attribute with the id                                 ${EMPTY}                                     ${EMPTY}  
010_02_delete an attribute with the datasetId                          urn:ngsi-ld:Property:gpsBxyz123-speed        ${EMPTY} 
010_01_delete an attribute with the id                                 ${EMPTY}                                     False  
010_02_delete an attribute with the datasetId                          urn:ngsi-ld:Property:gpsBxyz123-speed        False 
010_03_delete all target attribute instances with a datasetId          urn:ngsi-ld:Property:gpsBxyz123-speed        True   

*** Keywords ***
Append Attributes
Delete Attributes
    [Arguments]  ${datasetId}    ${deleteAll}
    [Documentation]  Check that you can delete an attribute from an entity
    [Tags]  mandatory  failing
@@ -26,7 +26,7 @@ Append Attributes
    ${entity_id}=     Generate Random Entity Id    ${vehicle_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

    Query Entity    ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    ${response}=    Delete Entity Attributes    ${entity_id}    ${attribute_id}    ${CONTENT_TYPE_LD_JSON}    ${datasetId}    ${deleteAll}
    Check Response Status Code  ${status_code}    ${response['status']}

+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Test Template  Append Attributes
Test Template  Delete Attributes

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
@@ -18,7 +18,7 @@ ${filename}= vehicle-two-datasetid-attributes-sample.jsonld
011_03_delete an attribute if the Attribute Name is not present        ${valid_entity_id}                           ${EMPTY}   

*** Keywords ***
Append Attributes
Delete Attributes
    [Arguments]  ${entity_id}    ${attribute_id}
    [Documentation]  Check that you cannot delete an attribute from an entity with invalid/missing ids
    [Tags]  mandatory  failing
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Test Template  Append Attributes
Test Template  Delete Attributes

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
@@ -18,7 +18,7 @@ ${filename}= vehicle-two-datasetid-attributes-sample.jsonld
012_03_delete an attribute when the Entity does not contain the target attribute with same datasetId        ${valid_entity_id}          speed            urn:ngsi-ld:Property:notFound

*** Keywords ***
Append Attributes
Delete Attributes
    [Arguments]  ${entity_id}    ${attribute_id}    ${datasetId}
    [Documentation]  Check that you cannot delete an attribute from an entity with invalid/missing ids
    [Tags]  mandatory  failing
Loading