Commit 33c622b6 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix(doc): declare the GeoJSON notification check and inline its use in 046_45

parent b8665c47
Loading
Loading
Loading
Loading
+1 −1
Changes for TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_44.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/NotificationUtils.resource
Resource            ${EXECDIR}/resources/SubscriptionUtils.resource

Test Setup          Start Local Server    ${notification_server_host}    ${notification_server_port}
Test Teardown       Delete Initial Subscription And Entity
Test Template       Update Entity And Check GeoJSON Notification

@@ -53,6 +52,7 @@ Update Entity And Check GeoJSON Notification
    ...    ${context_in_link_header}

    Create Subscription And Entity    ${subscription_filename}    ${building_filename}    ${entity_id_suffix}
    Start Local Server    ${notification_server_host}    ${notification_server_port}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    204    ${response.status_code}
+16 −18
Changes for TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_45.robot: 16 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -20,16 +20,28 @@ ${building_filename}= building-different-attributes-types.json
046_45_01 Show Changes In GeoJSON For An Update Of Property
    [Tags]    sub-notification    core_10_5_7    core_5_2_6_9_1    show_changes    since_v1.6.1
    [Setup]    Create Initial Subscription And Entity    ${subscription_payload_file_path}    046_45_01
    Update Attribute And Check Previous Value In GeoJSON Notification
    ...    name-fragment.jsonld
    ${response}=    Update Entity Attributes    ${entity_id}    name-fragment.jsonld    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    204    ${response.status_code}

    ${notification}    ${headers}=    Wait for notification    timeout=${10}

    Should be Equal    ${subscription_id}    ${notification}[subscriptionId]
    Check Notification Containing GeoJSON FeatureCollection
    ...    building-different-attributes-types-previous-property-046-45-01.geojson
    ...    ${notification}

046_45_02 Show Changes In GeoJSON For An Update Of The Geometry GeoProperty
    [Tags]    sub-notification    core_10_5_7    core_5_2_6_9_1    show_changes    since_v1.6.1
    [Setup]    Create Initial Subscription And Entity    ${subscription_payload_file_path}    046_45_02
    Update Attribute And Check Previous Value In GeoJSON Notification
    ...    location-fragment.jsonld
    ${response}=    Update Entity Attributes    ${entity_id}    location-fragment.jsonld    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    204    ${response.status_code}

    ${notification}    ${headers}=    Wait for notification    timeout=${10}

    Should be Equal    ${subscription_id}    ${notification}[subscriptionId]
    Check Notification Containing GeoJSON FeatureCollection
    ...    building-different-attributes-types-previous-geoproperty-046-45-02.geojson
    ...    ${notification}

046_45_03 Show Changes In GeoJSON When An Entity Is Deleted
    [Documentation]    Delete an entity and check the notification contains the previous values for all attributes
@@ -50,20 +62,6 @@ ${building_filename}= building-different-attributes-types.json


*** Keywords ***
Update Attribute And Check Previous Value In GeoJSON Notification
    [Documentation]    Update an attribute in entity and check the GeoJSON notification contains the previous value
    [Arguments]    ${fragment_filename}    ${expectation_filename}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    204    ${response.status_code}

    ${notification}    ${headers}=    Wait for notification    timeout=${10}

    Should be Equal    ${subscription_id}    ${notification}[subscriptionId]
    Check Notification Containing GeoJSON FeatureCollection
    ...    ${expectation_filename}
    ...    ${notification}

Create Initial Subscription And Entity
    [Arguments]    ${subscription_filename}    ${entity_id_suffix}
    Create Subscription And Entity    ${subscription_filename}    ${building_filename}    ${entity_id_suffix}
+13 −0
Changes for doc/analysis/checks.py: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ class Checks:
                Checks.check_notification_containing_entity_element,
            'Check Notification Containing Entities Elements':
                Checks.check_notification_containing_entities_elements,
            'Check Notification Containing GeoJSON FeatureCollection':
                Checks.check_notification_containing_geojson_featurecollection,
            'Check Body With Alternatives':
                Checks.check_body_with_alternatives
        }
@@ -426,6 +428,10 @@ class Checks:
                'params': ['filename', 'notification'],
                'position': [0, 1]
            },
            'Check Notification Containing GeoJSON FeatureCollection': {
                'params': ['filename', 'notification'],
                'position': [0, 1]
            },
            'Check Body With Alternatives': {
                'params': ['response_body', 'alternatives'],
                'position': [0, 1]
@@ -1131,6 +1137,13 @@ class Checks:
        else:
            raise Exception(f"ERROR, Expected 'filename' and 'notification' but received: '{kwargs}'")

    @staticmethod
    def check_notification_containing_geojson_featurecollection(kwargs: list) -> str:
        if 'filename' in kwargs and 'notification' in kwargs:
            return f"Notification containing GeoJSON FeatureCollection set to '{kwargs['filename']}'"
        else:
            raise Exception(f"ERROR, Expected 'filename' and 'notification' but received: '{kwargs}'")

    @staticmethod
    def check_content_range_part_equal(kwargs: list) -> str:
        if 'expected_part' in kwargs and 'part' in kwargs: