Commit 4644c5e9 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix(subscription): ensure tests subscriptions are deleted after each test

parent 011014e4
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -27,12 +27,10 @@ Delete Initial Subscriptions
Check that a notification is sent with all entities with matching context source
    [Documentation]     only the subscribed Entities whose origin Context Source matches the referred filter shall be included.
    [Tags]    sub-notification    5_11_7    046_06
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_payload}=    Load Subscription Sample With Reachable Endpoint    ${subscription_payload_file_path}    ${subscription_id}
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    ${entity_building}=    Create Entity Selecting Content Type    ${building_filename}    ${entity_id}    ${CONTENT_TYPE_LD_JSON}

    Set Suite Variable    ${subscription_id}
    Wait for subscription notification and validate it  ${subscription_id}  ${entity_building}  timeout=${5}


+7 −9
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ Add Initial Entity
Delete Initial Entity
    Delete Entity by Id    ${entity_id}

Delete Fixture Data
    Delete Initial Subscriptions
    Delete Initial Entity

Before Test
    NotificationUtils.Start Local Server    ${notification_server_host}    ${notification_server_port}

@@ -59,9 +63,7 @@ Check notification structure
    ${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}

    Delete Initial Subscriptions
    Delete Initial Entity
    [Teardown]  Delete Fixture Data

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).
@@ -77,9 +79,7 @@ Check correct attributes are included
    ${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
    [Teardown]  Delete Fixture Data

Check URI expansion is observed
    [Documentation]     The structure of the notification message shall be as mandated by clause 5.3.    URI expansion shall be observed (clause 5.5.7). 
@@ -95,9 +95,7 @@ Check URI expansion is observed
    ${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
    [Teardown]  Delete Fixture Data



+7 −5
Original line number Diff line number Diff line
@@ -34,12 +34,14 @@ Add Initial Entity
Delete Initial Entity
    Delete Entity by Id    ${entity_id}

Delete Fixture Data
    Delete Initial Subscriptions
    Delete Initial Entity

Before Test
    NotificationUtils.Start Local Server    ${notification_server_host}    ${notification_server_port}

After Test
    Delete Initial Subscriptions
    Delete Initial Entity
    Stop Local Server


@@ -63,8 +65,7 @@ Check that a notification is sent with all attributes
    Dictionary Should Contain Key    ${notification}[data][0]    almostFull
    Dictionary Should Contain Key    ${notification}[data][0]    airQualityLevel
    Dictionary Should Contain Key    ${notification}[data][0]    subCategory

    
    [Teardown]  Delete Fixture Data

Check that a notification is sent with all attributes in simplified format
    [Documentation]     The structure of the notification message shall be as mandated by clause 5.3.1. The absence of the notification.attributes member of a Subscription means that all Entity Attributes shall be included    If the notification.format member value is "keyValues" then a simplified representation of the entities (as mandated by clause 4.5.3) shall be provided
@@ -87,6 +88,7 @@ Check that a notification is sent with all attributes in simplified format
    ${list_count}=    Count Values In List    ${notification}
    Should Not Be Equal    ${list_count}    0
    Should Be Equal    ${notification}[0][id]   ${entity_id}
    [Teardown]  Delete Fixture Data