Commit b40892c1 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix(subscriptions): incorrect method calls or implementations and unused code

parent 6e0ccf5d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,6 +17,6 @@ Create Subscription With Invalid Request
    [Documentation]    Check that you cannot create a subscription with an invalid request
    [Tags]    sub-create    5_8_1
    Create Subscription From File    ${filename}
    Check RL Response Status Code Set To Expected Code    400
    Check RL Response Status Code Set To    400
    Check RL Response Body Containing ProblemDetails Element Containing Type Element set to    ${response}    ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check RL Response Body Containing ProblemDetails Element Containing Title Element    ${response}
+4 −7
Original line number Diff line number Diff line
*** Settings ***
Documentation     Check that a notification is only sent if and only if the status is active




Resource          ${EXECDIR}/resources/ApiUtils.resource
Resource          ${EXECDIR}/resources/AssertionUtils.resource
Resource          ${EXECDIR}/resources/JsonUtils.resource
@@ -56,7 +53,7 @@ Check notification structure
    Setup Initial Subscriptions
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    
    ${notification}    Wait for notification    ${subscription_id}   
    ${notification}    Wait for notification   
    Should Be Equal     ${notification}[type]   Notification
    Should Be Equal     ${notification}[subscriptionId]   ${subscription_id}
    ${is_date}=    Is Date    ${notification}[notifiedAt]    ${date_format}
@@ -73,7 +70,7 @@ Check correct attributes are included
    Setup Initial Subscriptions    ${subscription_payload_file_path_watchedAttributes}
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    
    ${notification}    Wait for notification    ${subscription_id}   
    ${notification}    Wait for notification  
    Should Be Equal     ${notification}[type]   Notification
    Should Be Equal     ${notification}[subscriptionId]   ${subscription_id}
    ${is_date}=    Is Date    ${notification}[notifiedAt]    ${date_format}
@@ -91,7 +88,7 @@ Check URI expansion is observed
    Setup Initial Subscriptions
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    
    ${notification}    Wait for notification    ${subscription_id}   
    ${notification}    Wait for notification   
    Should Be Equal     ${notification}[type]   Notification
    Should Be Equal     ${notification}[subscriptionId]   ${subscription_id}
    ${is_date}=    Is Date    ${notification}[notifiedAt]    ${date_format}
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ Check that a notification is sent with all attributes in simplified format
    ${notification}=    Wait for notification    ${5}

    Output     ${notification}
    ${notification}    Wait for notification    ${subscription_id}
    ${notification}    Wait for notification
    ${list_count}=    Count Values In List    ${notification}
    Should Not Be Equal    ${list_count}    0
    Should Be Equal    ${notification}[0][id]   ${entity_id}
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ Delete Initial Entity

*** Test Cases ***
Check that a notification is JSON
    [Documentation]     The Notification content shall be JSON by defaul
    [Documentation]     The Notification content shall be JSON by default
    [Tags]    sub-notification    5_11_7    046_10

    Add Initial Entity
@@ -55,7 +55,7 @@ Check that a notification is JSON

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

    Wait For Request    ${timeout}
    Wait For Request    10
    Reply By   200

    ${notification_payload}=     Get Request Body
+8 −16
Original line number Diff line number Diff line
@@ -5,31 +5,24 @@ Resource ${EXECDIR}/resources/ApiUtils.resource
Resource          ${EXECDIR}/resources/AssertionUtils.resource
Resource          ${EXECDIR}/resources/JsonUtils.resource
Resource          ${EXECDIR}/resources/NotificationUtils.resource
Resource          ${EXECDIR}/resources/MockServerUtils.resource


Suite Setup       Setup Initial Subscriptions
Suite Teardown    Delete Initial Subscriptions
Suite Setup       Setup Initial Subscription
Suite Teardown    Delete Initial Subscription

*** Variable ***
${subscription_id_prefix}=    urn:ngsi-ld:Subscription:
${subscription_payload_file_path}=    subscriptions/subscription-building-entities-active.jsonld
${building_id_prefix}=    urn:ngsi-ld:Building:
${fragment_filename}=    airQualityLevel-fragment.jsonld




*** Keywords ***
*** Test Case ***
Check that a notification is only sent if statis is active
    [Arguments]      ${fragment_filename}    
    [Documentation]     The notification.lastNotification member shall be updated with a timestamp representing the current date and time. This test will check the format.
    [Tags]    sub-notification    5_11_7
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_payload}=    Load Subscription Sample With Reachable Endpoint   ${subscription_payload_file_path}    ${subscription_id}
    [Tags]    sub-notification    5_11_7    046_13
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}

    @{expected_notification_data_entities}=    Create List    Building
    Set Suite Variable    ${subscription_id}
    Create Subscription  ${subscription_id}  ${subscription_payload}  
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}

    Wait for redirected request
@@ -42,11 +35,10 @@ Check that a notification is only sent if statis is active
Setup Initial Subscription
    Start Local Server
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_payload}=    Load Test Sample    ${subscription_payload_file_path}    ${subscription_id}
    Create Subscription  ${subscription_id}  ${subscription_payload}  
    Create Subscription     ${subscription_id}     ${subscription_payload_file_path}    ${CONTENT_TYPE_LD_JSON} 
    Set Suite Variable    ${subscription_id}

Delete Subscription
Delete Initial Subscription
    Stop Local Server
    Delete Subscription      ${subscription_id}

Loading