Commit 2ae41745 authored by Arnaud Van der Poorten's avatar Arnaud Van der Poorten
Browse files

(046) Fixed most remarks

parent b45c716d
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ Suite Teardown After Test
*** Variable ***
${subscription_id_prefix}=    urn:ngsi-ld:Subscription:
${subscription_payload_file_path}=    subscriptions/subscription-building-entities-active.jsonld
${subscription_payload_file_path_watchedAttributes}=    subscriptions/subscription-building-entities-active-watchedAttributes.jsonld
${building_id_prefix}=    urn:ngsi-ld:Building:
${notification_server_send_url}=     http://${send_notification_server_host}:${send_notification_server_port}/notify
${entity_building_filepath}=    building-simple-attributes-sample.jsonld
@@ -23,8 +24,9 @@ ${date_format_with_millis}= %Y-%m-%dT%H:%M:%S.%fZ

*** Keywords ***
Setup Initial Subscriptions
    [Arguments]    ${subscription_payload_path}=${subscription_payload_file_path}
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_payload}=    Load Subscription Sample With Reachable Endpoint    ${subscription_payload_file_path}    ${subscription_id}    ${notification_server_send_url}
    ${subscription_payload}=    Load Subscription Sample With Reachable Endpoint    ${subscription_payload_path}    ${subscription_id}    ${notification_server_send_url}
    ${subscription_payload}=    Set Entity Id In Subscription    ${subscription_payload}    ${entity_id}
    Create Subscription From Subscription Payload    ${subscription_payload}    ${CONTENT_TYPE_LD_JSON}
    Set Suite Variable    ${subscription_id}
@@ -54,7 +56,6 @@ Check notification structure
    Setup Initial Subscriptions
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    
    @{expected_notification_data_entities}=    Create List    Building
    ${notification}    Wait for notification    ${subscription_id}   
    Should Be Equal     ${notification}[type]   Notification
    Should Be Equal     ${notification}[subscriptionId]   ${subscription_id}
@@ -69,13 +70,16 @@ Check correct attributes are included
    [Documentation]     The structure of the notification message shall be as mandated by clause 5.3.    The Entity Attributes included (Properties or Relationships) shall be those specified by the notification.attributes member in the Subscription data type (clause 5.2.12).
    [Tags]    sub-notification    5_11_7    046_07_02
    Add Initial Entity
    Setup Initial Subscriptions
    Setup Initial Subscriptions    ${subscription_payload_file_path_watchedAttributes}
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    
    @{expected_notification_data_entities}=    Create List    Building
    ${notification}    Wait for notification    ${subscription_id}   

    # TODO
    Should Be Equal     ${notification}[type]   Notification
    Should Be Equal     ${notification}[subscriptionId]   ${subscription_id}
    ${is_date}=    Is Date    ${notification}[notifiedAt]    ${date_format}
    ${is_date_with_millis}=    Is Date    ${notification}[notifiedAt]    ${date_format_with_millis}
    Should Be True    ${is_date} or ${is_date_with_millis}
    Dictionary Should Contain Key    ${notification}[data][0]    airQualityLevel

    Delete Initial Subscriptions
    Delete Initial Entity
@@ -87,9 +91,13 @@ Check URI expansion is observed
    Setup Initial Subscriptions
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    
    @{expected_notification_data_entities}=    Create List    Building
    ${notification}    Wait for notification    ${subscription_id}   
    # TODO
    Should Be Equal     ${notification}[type]   Notification
    Should Be Equal     ${notification}[subscriptionId]   ${subscription_id}
    ${is_date}=    Is Date    ${notification}[notifiedAt]    ${date_format}
    ${is_date_with_millis}=    Is Date    ${notification}[notifiedAt]    ${date_format_with_millis}
    Should Be True    ${is_date} or ${is_date_with_millis}
    Dictionary Should Contain Key    ${notification}[data][0]    https://ngsi-ld-test-suite/context#airQualityLevel

    Delete Initial Subscriptions
    Delete Initial Entity
+4 −9
Original line number Diff line number Diff line
@@ -83,15 +83,10 @@ Check that a notification is sent with all attributes in simplified format
    ${notification}=    Wait for notification    ${5}

    Output     ${notification}
    Should be Equal    ${subscription_id}    ${notification}[subscriptionId]
    Dictionary Should Contain Key    ${notification}    data
    Should Not Be Empty    ${notification}[data]    Notification data should not be empty
    Should be Equal    ${entity_id}    ${notification}[data][0][id]
    Should be Equal    Eiffel Tower    ${notification}[data][0][name][value]
    Dictionary Should Contain Key    ${notification}[data][0]    almostFull
    Dictionary Should Contain Key    ${notification}[data][0]    airQualityLevel
    Dictionary Should Contain Key    ${notification}[data][0]    subCategory
    # TODO: difference between keyValue and not
    ${notification}    Wait for notification    ${subscription_id}
    ${list_count}=    Count Values In List    ${notification}
    Should Not Be Equal    ${list_count}    0
    Should Be Equal    ${notification}[0][id]   ${entity_id}
    
    

+5 −2
Original line number Diff line number Diff line
@@ -55,7 +55,10 @@ Check that a notification is JSON

    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}

    # Wait for notification parses the json of the request by default
    ${notification}=    Wait for notification    timeout=${10}
    Wait For Request    ${timeout}
    Reply By   200

    ${notification_payload}=     Get Request Body
    # json.loads parses the payload as json. It fails if the payload is malformed
    ${notification}    Evaluate    json.loads('''${notification_payload}''')    json
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
    "type": "Building",
    "name": {
        "type": "Property",
        "value": "Building1"
        "value": "Eiffel Tower"
    },
    "@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"
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
   "id":"urn:ngsi-ld:Subscription:randomUUID",
   "type":"Subscription",
   "isActive": true,
   "expiresAt": null,
   "watchedAttributes": ["airQualityLevel"],
   "q": "name==\"Eiffel%20Tower\"",
   "entities":[
Loading