Unverified Commit acd639f1 authored by Gaël Poujol's avatar Gaël Poujol Committed by GitHub
Browse files

fix: error of context and mismatch in expectation file (#5)

parent b2d0ab13
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -8,23 +8,25 @@ Test Template Create Temporal Entity
*** Variable ***
*** Variable ***
${vehicle_id_prefix}=    urn:ngsi-ld:Vehicle:
${vehicle_id_prefix}=    urn:ngsi-ld:Vehicle:


*** Test Cases ***    FILENAME                                                         CONTENT_TYPE
*** Test Cases ***    FILENAME                                                          EXPECTATION_FILENAME                                                              CONTENT_TYPE
007_01_01_Create a temporal representation of an entity
007_01_01_Create a temporal representation of an entity
                      vehicle-temporal-representation-sample.jsonld                    application/ld+json
                      vehicle-temporal-representation-sample.jsonld                     vehicle-temporal-representation-create-expectation.jsonld                         application/ld+json


007_01_02_Create a temporal entity with no context
007_01_02_Create a temporal entity with no context
                      vehicle-temporal-representation-without-context-sample.jsonld    application/json
                      vehicle-temporal-representation-without-context-sample.jsonld     vehicle-temporal-representation-create-with-no-context-expectation.jsonld         application/json


*** Keywords ***
*** Keywords ***
Create Temporal Entity
Create Temporal Entity
    [Arguments]    ${filename}    ${content_type}
    [Arguments]    ${filename}    ${expectation_filename}   ${content_type}
    [Documentation]    Check that you can create a temporal representation of an entity
    [Documentation]    Check that you can create a temporal representation of an entity
    [Tags]    te-create    5_6_11
    [Tags]    te-create    5_6_11
    ${temporal_entity_representation_id}=    Generate Random Entity Id    ${vehicle_id_prefix}
    ${temporal_entity_representation_id}=    Generate Random Entity Id    ${vehicle_id_prefix}
    ${response}=    Create Or Update Temporal Representation Of Entity Selecting Content Type    ${temporal_entity_representation_id}    ${filename}    ${content_type}
    ${response}=    Create Or Update Temporal Representation Of Entity Selecting Content Type    ${temporal_entity_representation_id}    ${filename}    ${content_type}
    Check Response Status Code    201    ${response['status']}
    Check Response Status Code    201    ${response['status']}
    ${created_temporal_entity}=    Load Test Sample    temporalEntities/${filename}    ${temporal_entity_representation_id}
    ${created_temporal_entity}=    Load Test Sample    temporalEntities/${filename}    ${temporal_entity_representation_id}
    Retrieve Temporal Representation Of Entity    ${temporal_entity_representation_id}
    Run Keyword If    '${content_type}'=='application/json'    Retrieve Temporal Representation Of Entity    ${temporal_entity_representation_id}
    Run Keyword If    '${content_type}'=='application/ld+json'    Retrieve Temporal Representation Of Entity    ${temporal_entity_representation_id}    context=${ngsild_test_suite_context}
    ${ignored_attributes}=    Create List    instanceId     @context
    ${ignored_attributes}=    Create List    instanceId     @context
    Check Created Resource Set To    ${created_temporal_entity}    ${ignored_attributes}
    ${temporal_entity_expectation_payload}=    Load Test Sample    temporalEntities/expectations/${expectation_filename}    ${temporal_entity_representation_id}
    Check Created Resource Set To    ${temporal_entity_expectation_payload}    ${ignored_attributes}
    [Teardown]    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
    [Teardown]    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ Create Temporal Entity From File
    [Tags]    te-create    5_6_11
    [Tags]    te-create    5_6_11
    Create Temporal Representation Of Entity Selecting Content Type Using Session    ${filename}    ${CONTENT_TYPE_LD_JSON}
    Create Temporal Representation Of Entity Selecting Content Type Using Session    ${filename}    ${CONTENT_TYPE_LD_JSON}
    Check RL Response Status Code Set To    400
    Check RL Response Status Code Set To    400
    Check Response Body Type When Using Session Request    ${response.json()}    ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Type When Using Session Request    ${response.json()}    ${ERROR_TYPE_INVALID_REQUEST}
    Check Response Body Title When Using Session Request    ${response.json()}
    Check Response Body Title When Using Session Request    ${response.json()}


Create Temporal Entity
Create Temporal Entity
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource
${vehicle_id_prefix}=    urn:ngsi-ld:Vehicle:
${vehicle_id_prefix}=    urn:ngsi-ld:Vehicle:
${filename}=      vehicle-temporal-representation-sample.jsonld
${filename}=      vehicle-temporal-representation-sample.jsonld
${fragment_filename}=    vehicle-temporal-instanceid-update-fragment.jsonld
${fragment_filename}=    vehicle-temporal-instanceid-update-fragment.jsonld
${expectation_filename}=    vehicle-temporal-representation-update-expectation.jsonld
${expectation_filename}=    vehicle-temporal-representation-partial-update-attribute-expectation.jsonld
${attributeId}=    speed
${attributeId}=    speed


*** Test Cases ***
*** Test Cases ***
+35 −0
Original line number Original line Diff line number Diff line
{
   "id":"urn:ngsi-ld:Vehicle:randomUUID",
   "type":"Vehicle",
   "brandName":[],
   "speed":[
      {
         "type":"Property",
         "value":120,
         "observedAt":"2020-09-01T12:03:00Z"
      },
      {
         "type":"Property",
         "value":80,
         "observedAt":"2020-09-01T12:05:00Z"
      }
   ],
   "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",
         "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel"
      }
   ]
}
 No newline at end of file
+39 −0
Original line number Original line Diff line number Diff line
{
   "id":"urn:ngsi-ld:Vehicle:randomUUID",
   "type":"Vehicle",
   "brandName":[],
   "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"
      }
   ],
   "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"
      }
   ]
}
 No newline at end of file
Loading