Commit 2473b9d7 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix: provide a context when deleting an temporal attribute in 015_01

parent 056029ff
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -13,9 +13,9 @@ ${status_code}= 204
${attribute_id}=  fuelLevel

*** Test Cases ***                                                                                         DELETEALL          DATASETID                                 EXPECTATION_FILE
015_01_01_Delete an attribute from a temporal representation of an entity without deleteALL/datasetID      false              ${EMPTY}                                  vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld
015_01_01_Delete an attribute from a temporal representation of an entity without deleteAll/datasetId      false              ${EMPTY}                                  vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld
015_01_02_Delete an attribute from a temporal representation of an entity with datasetId                   false              urn:ngsi-ld:Vehicle:12345-fuel            vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld
015_01_03_Delete an attribute from a temporal representation of an entity with deleteALL/datasetID         true               urn:ngsi-ld:Vehicle:12345-fuel            vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld
015_01_03_Delete an attribute from a temporal representation of an entity with deleteAll                   true               ${EMPTY}                                  vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld

*** Keywords ***
Delete Attribute From A Temporal Entity
@@ -27,7 +27,7 @@ Delete Attribute From A Temporal Entity
    ${response}=  Create Or Update Temporal Representation Of Entity Selecting Content Type  ${temporal_entity_representation_id}    ${filename}     ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

    ${response}=  Delete Attribute From Temporal Entity  ${temporal_entity_representation_id}    ${attribute_id}     ${CONTENT_TYPE_LD_JSON}    ${datasetId}    ${deleteAll}
    ${response}=  Delete Attribute From Temporal Entity  ${temporal_entity_representation_id}    ${attribute_id}     ${CONTENT_TYPE_JSON}    ${datasetId}    ${deleteAll}   ${ngsild_test_suite_context}
    Check Response Status Code   ${status_code}    ${response['status']}

    ${temporal_entity_expectation_payload}=    Load Test Sample   temporalEntities/expectations/${expectation_filename}    ${temporal_entity_representation_id}
+7 −2
Original line number Diff line number Diff line
@@ -355,9 +355,14 @@ Partial Update Attribute From Temporal Entity
    [return]   ${response}

Delete Attribute From Temporal Entity
    [Arguments]  ${entityId}    ${attributeId}    ${content_type}    ${datasetId}     ${deleteAll}
    [Arguments]  ${entityId}    ${attributeId}    ${content_type}    ${datasetId}     ${deleteAll}      ${context}=${EMPTY}
    &{headers}=  Create Dictionary  Content-Type=${content_type}
    ${response}=  DELETE  ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${entityId}/attrs/${attributeId}?datasetId=${datasetId}&deleteAll=${deleteAll}  headers=${headers}
    Run Keyword If     '${context}'!=''       Set To Dictionary   ${headers}   Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json"
    @{params}=  Create List
    Run Keyword If     '${datasetId}'!=''       Append To List   ${params}    datasetId=${datasetId}
    Run Keyword If     '${deleteAll}'!=''       Append To List   ${params}    deleteAll=${deleteAll}
    ${params_as_string}=    Catenate    SEPARATOR=&     @{params}
    ${response}=  DELETE  ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${entityId}/attrs/${attributeId}?${params_as_string}   headers=${headers}
    Output  request
    Output  response
    [return]   ${response}