Commit 976f6d2a authored by lopesg's avatar lopesg
Browse files

fixed 044_02

parent ec4db086
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ ${building_expectation}= building-simple-attributes-sample-expectation.json
${entity_type}=  https://ngsi-ld-test-suite/context#Building

${subscription_id_prefix}=  urn:ngsi-ld:Subscription:
${subscription_filename}=  csourceSubscriptions/subscription-sample.jsonld
${subscription_filename}=  subscriptions/subscription-sample.jsonld
${subscription_expectation}=  subscription-sample-expectation.json

${registration_id_prefix}=  urn:ngsi-ld:Registration:
@@ -21,9 +21,12 @@ ${registration_type}= Vehicle

${tea_id_prefix}=  urn:ngsi-ld:Vehicle:
${tea_filename}=  vehicle-temporal-representation-sample.jsonld
${tea_expectation}=  vehicle-temporal-representation-expectation.json
${tea_expectation}=  vehicles-temporal-representation-044-02-04-expectation.json
${teatype}=  Vehicle

${content_type}=  application/json
${accept}=  application/json, */* 

*** Test Cases ***
044_02_01_endpoint /entities/{entityId}
    [Documentation]  Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/{entityId})
@@ -31,14 +34,15 @@ ${teatype}= Vehicle
    ${request}    ${response}=    Create Entity Selecting Content Type  ${building_filename}     ${id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

    ${request}    ${response}=    Query Entity    ${id}
    ${request}    ${response}=    Query Entity    ${id}    context=${ngsild_test_suite_context}
    Check Response Status Code  200    ${response['status']}
    Check Response Body Containing Entity element    ${building_expectation}    ${id}    ${response['body']}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Request Containing Accept Header Set To  ${request}    ${accept}
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Entity by Id Returning Response   ${id}
  

044_02_02_endpoint /subscriptions/{subscriptionId}
    [Documentation]  Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/{subscriptionId})

@@ -49,7 +53,9 @@ ${teatype}= Vehicle
    ${request}    ${response}=  Retrieve Subscription  ${id}
    Check Response Status Code  200    ${response['status']}
    Check Response Body Containing One Subscription element    ${subscription_expectation}    ${response['body']}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Request Containing Accept Header Set To  ${request}    ${accept}
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Subscription  ${id}

@@ -62,10 +68,12 @@ ${teatype}= Vehicle
    ${request}    ${response}=    Create Context Source Registration With Return  ${updated_payload}
    Check Response Status Code  201    ${response['status']}

    ${request}    ${response}=  Query Context Source Registrations With Return      id=${registration_id}    type=${registration_type}
    ${request}    ${response}=  Query Context Source Registrations With Return      id=${registration_id}    type=${registration_type}    context=${ngsild_test_suite_context}
    Check Response Status Code  200    ${response['status']}
    Check Response Body Containing One Registration element  ${registration_expectation}    ${response['body']}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Request Containing Accept Header Set To  ${request}    ${accept}
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Context Source Registration    ${registration_id}

@@ -75,10 +83,12 @@ ${teatype}= Vehicle
    ${temporal_entity_representation_id}=     Generate Random Entity Id    ${tea_id_prefix}
    Create Temporal Representation Of Entity  ${tea_filename}     ${temporal_entity_representation_id}

    ${request}    ${response}=  Query Temporal Representation Of Entities With Return   entity_types=${teatype}    timerel=after    timeAt=2020-08-01T12:05:00Z
    ${request}    ${response}=  Query Temporal Representation Of Entities With Return   entity_types=${teatype}    timerel=after    timeAt=2020-08-01T12:05:00Z    context=${ngsild_test_suite_context}
    Check Response Status Code  200    ${response['status']}
    Set Test Variable  ${response}
    Check Response Body Containing EntityTemporal element      ${tea_expectation}    ${temporal_entity_representation_id}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Request Containing Accept Header Set To  ${request}    ${accept}
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
 No newline at end of file
+8 −8
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Building:randomUUID",
        "type": "https://ngsi-ld-test-suite/context#Building",
    "https://ngsi-ld-test-suite/context#name": {
            "type": "Property",
            "value": "Eiffel Tower"
    },
    "https://ngsi-ld-test-suite/context#airQualityLevel": {
    "type": "Building",
    "airQualityLevel": {
        "type": "Property",
        "value": 4,
        "observedAt": "2020-09-09T16:40:00.000Z",
        "unitCode": "C62"
    },
    "https://ngsi-ld-test-suite/context#almostFull": {
    "almostFull": {
        "type": "Property",
        "value": false
    },
    "https://ngsi-ld-test-suite/context#subCategory": {
    "subCategory": {
        "type": "Property",
        "value": "tourism"
    },
    "name": {
        "type": "Property",
        "value": "Eiffel Tower"
    }
}
 No newline at end of file
+0 −44
Original line number Diff line number Diff line
{
   "id":"urn:ngsi-ld:Vehicle:randomUUID",
   "type": "https://ngsi-ld-test-suite/context#Vehicle",
   "https://ngsi-ld-test-suite/context#brandName": {
       "type": "Property",
       "value": "BMW",
       "instanceId": "urn:ngsi-ld:76739600-3d5c-4cfd-939d-34742a13b52d"
   },
   "https://ngsi-ld-test-suite/context#fuelLevel": [
       {
           "type": "Property",
           "datasetId": "urn:ngsi-ld:Vehicle:12345-fuel",
           "value": 40,
           "instanceId": "urn:ngsi-ld:0f6e7514-e3ed-46a6-9e9f-6bb02ff687bf",
           "observedAt": "2020-09-01T14:07:00Z"
       },
       {
           "type": "Property",
           "value": 53,
           "instanceId": "urn:ngsi-ld:59ebe244-14d6-4428-87e1-cd313748125c",
           "observedAt": "2020-09-01T13:05:00Z"
       },
       {
           "type": "Property",
           "value": 67,
           "instanceId": "urn:ngsi-ld:8bfeea42-8ed3-4d4e-a942-c389229bd6ff",
           "observedAt": "2020-09-01T12:03:00Z"
       }
   ],
   "https://ngsi-ld-test-suite/context#speed": [
       {
           "type": "Property",
           "value": 120,
           "instanceId": "urn:ngsi-ld:ec47b86f-656e-4182-b1c2-fbe5af5b4862",
           "observedAt": "2020-09-01T12:03:00Z"
       },
       {
           "type": "Property",
           "value": 80,
           "instanceId": "urn:ngsi-ld:f3ffc7ad-e562-4081-bd8a-5dda92ab0ffd",
           "observedAt": "2020-09-01T12:05:00Z"
       }
   ]
}
 No newline at end of file
+76 −0
Original line number Diff line number Diff line
[
   {
      "id":"urn:ngsi-ld:Vehicle:randomUUID",
      "type":"Vehicle",
      "brandName":{
         "type":"Property",
         "value":"Volvo"
      },
      "fuelLevel":[
         {
            "type":"Property",
            "value":53,
            "observedAt":"2020-08-01T13:05:00Z"
         },
         {
            "type":"Property",
            "value":40,
            "observedAt":"2020-08-01T14:07:00Z"
         }
      ],
      "speed":[
         {
            "type":"Property",
            "value":80,
            "observedAt":"2020-08-01T12:05:00Z"
         },
         {
            "type":"Property",
            "value":100,
            "observedAt":"2020-08-01T12:07:00Z"
         }
      ]
   },
   {
      "id":"urn:ngsi-ld:Vehicle:randomUUID",
      "type":"Vehicle",
      "brandName":{
         "type":"Property",
         "value":"BMW"
      },
      "fuelLevel":[
         {
            "type":"Property",
            "value":67,
            "observedAt":"2020-09-01T12:03:00Z"
         },
         {
            "type":"Property",
            "value":53,
            "observedAt":"2020-09-01T13:05:00Z"
         },
         {
            "type":"Property",
            "value":40,
            "observedAt":"2020-09-01T14:07:00Z"
         }
      ],
      "speed":[
         {
            "type":"Property",
            "value":120,
            "observedAt":"2020-09-01T12:03:00Z"
         },
         {
            "type":"Property",
            "value":80,
            "observedAt":"2020-09-01T12:05:00Z"
         },
         {
            "type":"Property",
            "value":100,
            "observedAt":"2020-09-01T12:07:00Z"
         }
      ]
   }
]
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -43,6 +43,14 @@ Check Request Containing Accept Header Set To
    Run Keyword If  'Accept' in ${request['headers']}  Should Be Equal  ${expected_accept_content}        ${request['headers']['Accept']}     ignore_order=True
    Run Keyword If  'accept' in ${request['headers']}  Should Be Equal  ${expected_accept_content}        ${request['headers']['accept']}     ignore_order=True

Check Response Headers Containing Content-Type set to
    [Arguments]  ${response}    ${expected_content_type_content} 
    Should Be Equal  ${response['headers']['Content-Type']}    ${expected_content_type_content}

Check Response Headers Link Not Empty
    [Arguments]  ${response}
    Should Not Be Empty  ${response['headers']['Link']}

# Since Http headers names are case-insensitive (from Http specification)
# We check both Location and location headers
Check Response Headers Containing URI set to
@@ -53,6 +61,7 @@ Check Response Headers Containing URI set to

# Since Http headers names are case-insensitive (from Http specification)
# We check both Location and location headers

Check Response Headers ID Not Empty
    [Arguments]  ${response}