Commit 2981ad04 authored by Benedetta Arena's avatar Benedetta Arena
Browse files

feat: update test cases for querying entities and improve payload structure

parent 6dfc5e57
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ ${b3_url}
${b4_url}

*** Test Cases ***
IOP_CNF_02_02 Query Properties Of Entities Of Type OffstreetParking And Vehicle
IOP_CNF_02_02 Query Entities Of Type OffstreetParking And Vehicle with attrs
    [Documentation]    Pre-conditions: no user context. Data only on leaves. B contains OffStreetParking1 and Vehicle1. C contains OffStreetParking1 with location and name only and OffStreetParking2. D contains OffStreetParking2 with location and name only and Vehicle2.
    ...                Registrations established: Inclusive in A to B. Redirect in A to C. Redirect in A to D.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    proxy-redirect    4_3_6    5_7_2    6_4_3_1
+10 −10
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ Test Setup Setup Initial Context Source Registrations
Test Teardown       Delete Entities and Delete Registrations

*** Variables ***
${first_offstreet_no_location_payload_filename}       interoperability/offstreet-parking1-no-location.jsonld
${second_offstreet_no_location_payload_filename}      interoperability/offstreet-parking2-no-location.jsonld
${full_offstreet_payload_filename}                    interoperability/offstreet-parking1-full.jsonld
${offstreet_no_location_payload_filename}             interoperability/offstreet-parking2-no-location.jsonld
${first_full_offstreet_payload_filename}              interoperability/offstreet-parking1-full.jsonld
${second_full_offstreet_payload_filename}             interoperability/offstreet-parking2-full.jsonld
${first_inclusive_registration_payload_file_path}     csourceRegistrations/interoperability/context-source-registration-inclusive-1.jsonld
${second_inclusive_registration_payload_file_path}    csourceRegistrations/interoperability/context-source-registration-inclusive-2.jsonld
${auxiliary_registration_payload_file_path}           csourceRegistrations/interoperability/context-source-registration-auxiliary-1.jsonld
@@ -48,25 +48,25 @@ IOP_CNF_03_01 Query Entities Of Type OffstreetParking Via GET

    ${response}=    Query Entities    entity_types=OffstreetParking    broker_url=${b4_url}
    ${payload}=    Evaluate    {i['id']: i for i in ${response.json()}}
    ${expected_parking3}=    Get From Dictionary    ${payload}    OffstreetParking:1
    ${expected_parking3}=    Get From Dictionary    ${payload}    OffstreetParking:2

    #Client checks that the attributes of the entities in A are the same as the ones in B, C and D.
    Should Be Equal    ${first_parking_payload}[name]    ${expected_parking2}[name]
    Should Be Equal    ${first_parking_payload}[location]    ${expected_parking2}[location]
    Should Be Equal    ${first_parking_payload}[availableSpotsNumber]    ${expected_parking3}[availableSpotsNumber]
    Should Be Equal    ${first_parking_payload}[totalSpotsNumber]    ${expected_parking3}[totalSpotsNumber]
    Should Be Equal    ${second_parking_payload}    ${expected_parking1}
    Should Be Equal    ${second_parking_payload}[availableSpotsNumber]    ${expected_parking3}[availableSpotsNumber]
    Should Be Equal    ${second_parking_payload}[totalSpotsNumber]    ${expected_parking3}[totalSpotsNumber]
    Should Not Be Equal    ${second_parking_payload}[availableSpotsNumber]    ${expected_parking1}[availableSpotsNumber]

*** Keywords ***
Setup Initial Context Source Registrations
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}

    ${response}=    Create Entity    ${second_offstreet_no_location_payload_filename}    ${entity_id}    broker_url=${b2_url}
    ${response}=    Create Entity    ${offstreet_no_location_payload_filename}    ${entity_id}    broker_url=${b2_url}
    Check Response Status Code    201    ${response.status_code}
    ${response}=    Create Entity    ${full_offstreet_payload_filename}    ${entity_id}    broker_url=${b3_url}
    ${response}=    Create Entity    ${first_full_offstreet_payload_filename}    ${entity_id}    broker_url=${b3_url}
    Check Response Status Code    201    ${response.status_code}
    ${response}=    Create Entity    ${first_offstreet_no_location_payload_filename}    ${entity_id}    broker_url=${b4_url}
    ${response}=    Create Entity    ${second_full_offstreet_payload_filename}    ${entity_id}    broker_url=${b4_url}
    Check Response Status Code    201    ${response.status_code}

    ${registration_id1}=    Generate Random CSR Id
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ ${b3_url}
${b4_url}

*** Test Cases ***
IOP_CNF_03_02 Query Properties Of Entities Of Type OffstreetParking And Vehicle
IOP_CNF_03_02 Query Entities Of Type OffstreetParking And Vehicle with attrs
    [Documentation]    Pre-conditions: No user context. Data only on leaves. B contains Vehicle:1. C contains OffStreetParking:1 with location and name only. D contains OffStreetParking:1, OffStreetParking:2 and Vehicle2.
    ...                Registrations established: Auxiliary in A to B. Inclusive in A to C. Inclusive in A to D.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    additive-auxiliary    4_3_6    5_7_2    6_4_3_1
+30 −30
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Vehicle:2",
    "type": "Vehicle",
    "brandName": {
  "id": "urn:ngsi-ld:OffStreetParking:2",
  "type": "OffStreetParking",
  "name": {
    "type": "Property",    
        "value": "Brand2"
    "value": "Downtown Two"
  },
    "speed": {
  "availableSpotsNumber": {
    "type": "Property",
        "value": 10,
        "source": {
    "value": 87,
    "observedAt": "2017-07-29T12:10:02Z",
    "reliability": {
      "type": "Property",
            "value": "Speedometer"
      "value": 0.55
    }
  },
    "isParked": {
        "type": "Relationship",
        "object": "urn:ngsi-ld:OffStreetParking:2",
        "observedAt": "2017-07-28T12:00:04Z"
  "totalSpotsNumber": {
    "type": "Property",
    "value": 150
  },
  "@context": [
    {
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ Query Entities
    ...    ${pick}=${EMPTY}
    ...    ${omit}=${EMPTY}
    ...    ${orderBy}=${EMPTY}
    ...    ${broker_url}=${EMPTY}
    ${final_url}=    Set Variable If    '${broker_url}'!=''    ${broker_url}    ${url}
    ${attrs_length}=    Get Length    ${attrs}
    ${accept_length}=    Get Length    ${accept}
    ${options_length}=    Get Length    ${options}