Commit 82c07d26 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix: TCs to delete attribute instance(s) in 013_01

parent b2855527
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -13,9 +13,9 @@ ${filename}= vehicle-two-datasetid-attributes-sample.jsonld
${attribute_id}=  speed

*** 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_01_delete an attribute with the default instance                   ${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
013_01_03_delete all target attribute instances                           ${EMPTY}                                    true            vehicle-delete-deleteall-speed-expectation.jsonld

*** Keywords ***
Delete Attributes
@@ -27,7 +27,7 @@ Delete Attributes
    ${request}    ${response}=    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

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

    ${entity_expectation_payload}=    Load Test Sample   entities/expectations/${expectation_filename}    ${entity_id}
+4 −6
Original line number Diff line number Diff line
@@ -15,15 +15,13 @@
        },
        "datasetId": "urn:ngsi-ld:Relationship:parked12345"
    },
    "speed": 
    {
    "speed": {
        "type": "Property",
        "value": 54.5,
        "value": 55,
        "source": {
            "type": "Property",
            "value": "GPS"
        },
        "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed"
            "value": "Speedometer"
        }
    }, 
    "@context": [
        "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld"
+8 −2
Original line number Diff line number Diff line
@@ -177,8 +177,14 @@ Update Entity Attributes
    [return]   ${response}

Delete Entity Attributes
    [Arguments]  ${entityId}     ${attributeId}     ${datasetId}    ${deleteAll}
    ${response}=  DELETE  ${ENTITIES_ENDPOINT_PATH}${entityId}/attrs/${attributeId}?datasetId=${datasetId}&deleteAll=${deleteAll}
    [Arguments]  ${entityId}     ${attributeId}     ${datasetId}    ${deleteAll}    ${context}=${EMPTY}
    &{headers}=  Create Dictionary  Content-Type=${CONTENT_TYPE_JSON}
    Run Keyword If     '${context}'!='${EMPTY}'   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  ${ENTITIES_ENDPOINT_PATH}${entityId}/attrs/${attributeId}?${params_as_string}     headers=${headers}
    Output  request
    Output  response
    [return]    ${response}