Commit 2cad72cc authored by kzangeli's avatar kzangeli
Browse files

fix(tests): follow the suite context now that it defines isParked

Upstream added isParked, reliability, availableSpotsNumber and
totalSpotsNumber to the test suite's own @context. Twelve Test Purposes
had been relying on those names NOT being defined: a name that lands in
the default context compacts back to its short form under the core
context alone, and a name the suite context claims does not.

Nothing about the brokers changed - the same names now mean something
else, so the tests were asking the wrong questions.

Three shapes of fix, all of them the pattern the suite already uses
elsewhere:

  - expectations compared against a core-context retrieval now carry the
    expanded name, because that is what comes back
  - the two _inc appends pass context= on both the append and the
    retrieval, exactly as their _exc siblings already do; without it the
    fragment's isParked expanded into the default context and appended a
    SECOND attribute instead of overwriting the first
  - the Context Source mocks serve the .jsonld payload rather than the
    bare .json, so the attribute the Context Source contributes is the
    same attribute the test then looks for - it was arriving compacted
    as "ngsi-ld:default-context/isParked"

The suite context branch is now an env var (NGSILD_TEST_SUITE_BRANCH),
still defaulting to develop. It cannot default to this branch: 343
payload and expectation files name the develop URL literally, so moving
only the variable makes the suite disagree with itself.

1046/1046 against coraine.
parent aa9f956c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ ${building_filename}= building-minimal.jsonld
${vehicle_filename}=        vehicle-simple-attributes.jsonld
${expectation_filename}=    vehicle-simple-attributes-core-context.json
${attribute_brandname}=     https://ngsi-ld-test-suite/context#brandName
${attribute_isparked}=      https://uri.etsi.org/ngsi-ld/default-context/isParked
${attribute_isparked}=      https://ngsi-ld-test-suite/context#isParked


*** Test Cases ***
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour


*** Variables ***
${entity_payload_filename}              vehicle-simple-attributes.json
${entity_payload_filename}              vehicle-simple-attributes.jsonld
${entity_payload_filename2}             vehicle-simple-attributes-second.jsonld
${registration_payload_file_path}       csourceRegistrations/context-source-registration-vehicle-complete.jsonld
${fragment_filename}                    vehicle-brandname-fragment.json
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour


*** Variables ***
${entity_payload_filename}              vehicle-simple-attributes.json
${entity_payload_filename}              vehicle-simple-attributes.jsonld
${entity_payload_filename2}             vehicle-simple-attributes-second.jsonld
${registration_payload_file_path}       csourceRegistrations/context-source-registration-vehicle-complete.jsonld
${fragment_filename}                    vehicle-brandname-fragment.json
+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour

*** Variables ***
${entity_id_prefix}                     urn:ngsi-ld:Vehicle:
${entity_payload_filename}              vehicle-simple-attributes.json
${entity_payload_filename2}             vehicle-simple-attributes-second.json
${entity_payload_filename}              vehicle-simple-attributes.jsonld
${entity_payload_filename2}             vehicle-simple-attributes-second.jsonld
${registration_id_prefix}               urn:ngsi-ld:Registration:
${registration_payload_file_path}       csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld

+3 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ D003_01_inc Append Entity Attribute
    [Documentation]    Check that, given an inclusive registration, appending entity attributes updates the Context Source accordingly.
    [Tags]    since_v1.6.1    dist-ops    4_3_3    cf_06    additive-inclusive    4_3_6_2    5_6_3

    ${response}=    Retrieve Entity    ${entity_id}
    ${response}=    Retrieve Entity    ${entity_id}    context=${ngsild_test_suite_context}
    ${old_body}=    Get From Dictionary    ${response.json()}    isParked

    Set Stub Reply    POST    /ngsi-ld/v1/entities/${entity_id}/attrs/    204
@@ -32,12 +32,13 @@ D003_01_inc Append Entity Attribute
    ...    ${entity_id}
    ...    ${fragment_filename}
    ...    ${CONTENT_TYPE_JSON}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    204    ${response.status_code}

    ${stub_count}=    Get Stub Count    POST    /ngsi-ld/v1/entities/${entity_id}/attrs/
    Should Be Equal As Integers    ${stub_count}    1

    ${response}=    Retrieve Entity    ${entity_id}
    ${response}=    Retrieve Entity    ${entity_id}    context=${ngsild_test_suite_context}
    ${new_body}=    Get From Dictionary    ${response.json()}    isParked

    Should Have Value In Json    ${response.json()}    $.speed
Loading