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

test 046_01

parent 94612f5e
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -46,9 +46,16 @@ Check that a notification is only sent if status is active
    [Tags]    sub-notification    5_11_7
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix} 
    Create Entity    ${entity_building_filepath}    ${entity_id}
    
    @{expected_notification_data_entities}=    Create List    Building
    
    Output    Before:
    Query Entity    ${entity_id}
    Sleep    5
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}

    Wait for subscription notification and validate it  ${subscription_id}  ${expected_notification_data_entities}  timeout=${10}    expected_notification_type=Notification
 No newline at end of file
    Output    After:
    Query Entity    ${entity_id}
    ${notification}=    Wait for notification    timeout=${5}
    Output    Notification:
    Output    ${notification}

    Should be Equal    ${subscription_id}    ${notification}[subscriptionId]
    Should be Equal    ${entity_id}    ${notification}[data][0][id]
    Should be Equal    5    ${notification}[data][0][https://ngsi-ld-test-suite/context#airQualityLevel][value]    
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
    "type": "Building",
    "name": {
        "type": "Property",
        "value": "C"
        "value": "Eiffel Tower"
    },
    "subCategory": {
        "type": "Property",
+7 −2
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ Wait for notification
    Wait For Request    ${timeout}
    Reply By   200

    ${notification_payload}=     Get Request Body
    ${notification}    Evaluate    json.loads('''${notification_payload}''')    json
    [Return]    ${notification}

Wait for notification and validate it
    [Arguments]  ${expected_subscription_id}     ${expected_context_source_registration_ids}      ${expected_trigger_reason}      ${expected_notification_data_entities}=${EMPTY}     ${timeout}=${5}
    #HTTP server receives it and checks incoming request for correctness
@@ -60,6 +64,7 @@ Wait for notification and validate it

Wait for subscription notification and validate it
    [Arguments]  ${expected_subscription_id}  ${expected_notification_data_entities}=${EMPTY}  ${timeout}=${5}    ${expected_notification_type}=${notification_type}
    Wait for subscription notification    ${expected_subscription_id}    ${expected_notification_data_entities}    ${timeout}    ${expected_notification_type} 
    #HTTP server receives it and checks incoming request for correctness
    #.. "Wait For Request"
    #.... This call is blocked until HTTP request arrives or timeout.
@@ -72,7 +77,6 @@ Wait for subscription notification and validate it
    ${notification_data_length}=    Get length    ${notification}[data]
    ${expected_notification_data_entities_length}=    Get length    ${expected_notification_data_entities}


    log     ${notification}
    Should Be Equal     ${notification}[type]   ${expected_notification_type}
    Should Be Equal     ${notification}[subscriptionId]   ${expected_subscription_id}
@@ -82,7 +86,8 @@ Wait for subscription notification and validate it
    ${index}=    Set Variable    0
    
    # TODO Currently we check entities information of the first CSR returned in the notification, find a way to check them all
    # Run Keyword If     ${expected_notification_data_entities_length}>0       Check Notification Data Entities  ${notification}[data][0][information]    ${expected_notification_data_entities}
    Run Keyword If     ${expected_notification_data_entities_length}>0       Check Notification Data Entities  ${notification}[data][0][information]    ${expected_notification_data_entities}
    [return] ${notification}