Commit 47074be8 authored by Marco Cavalli's avatar Marco Cavalli
Browse files

Support when/then clauses in Distributed Operations Tables

parent e8734da0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -59,14 +59,14 @@ Setup Registration And Context Source Mock Server And Query The Context Broker W
    @{entities_id}=    Create List    ${entity_id}

    IF    '${method}' == 'GET'
        ${response}=    Query Entities    entity_types=Vehicle    context=${ngsild_test_suite_context}
        ${response2}=    Query Entities    entity_types=Vehicle    context=${ngsild_test_suite_context}
    ELSE IF    '${method}' == 'POST'
        @{entities}=    Create List    ${entity_id}
        ${response}=    Query Entities Via POST    entities=${entities}    context=${ngsild_test_suite_context}
        ${response2}=    Query Entities Via POST    entities=${entities}    context=${ngsild_test_suite_context}
    END

    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing Entities URIS set to    ${entities_id}    ${response.json()}
    Check Response Status Code    200    ${response2.status_code}
    Check Response Body Containing Entities URIS set to    ${entities_id}    ${response2.json()}

Delete Registration And Stop Context Source Mock Server
    Delete Context Source Registration    ${registration_id}
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ D007_01_exc Replace Entity
    ${stub_count}=    Get Stub Count    PUT    /broker1/ngsi-ld/v1/entities/${entity_id}
    Should Be Equal    ${stub_count}    1

    ${response}=    Retrieve Entity By Id    ${entity_id}    context=${ngsild_test_suite_context}    local=true
    ${response}=    Retrieve Entity by Id    ${entity_id}    context=${ngsild_test_suite_context}    local=true
    ${body}=    Get From Dictionary    ${response.json()}    speed
    Should Not Contain    ${body}    speed

+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ D007_01_inc Replace Entity
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    204    ${response.status_code}

    ${response}=    Retrieve Entity By Id    ${entity_id}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity by Id    ${entity_id}    context=${ngsild_test_suite_context}
    ${new_body}=    Set To Dictionary    ${response.json()}
    Should Not Be Equal    ${old_body}    ${new_body}

+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ D004_01_exc Create Entity and Registration And Start Context Source Mock Server
    ...    ${entity_id}
    ...    ${entity_newSpeed_filename}
    ...    ${CONTENT_TYPE_LD_JSON}
    ${response}=    Check Response Status Code    204    ${response.status_code}

    Check Response Status Code    204    ${response.status_code}
    
    ${stub_count}=    Get Stub Count    PATCH    /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/
    Should Be True    ${stub_count} > 0
+19 −0
Original line number Diff line number Diff line
@@ -98,10 +98,14 @@ class Checks:
                Checks.should_be_equal,
            'Dictionary Should Contain Key':
                Checks.dictionary_should_contain_key,
            'Dictionary Should Not Contain Key':
                Checks.dictionary_should_not_contain_key,
            'Should Not Be Empty':
                Checks.should_not_be_empty,
            'Should be True':
                Checks.should_be_true,
            'Should Be True':
                Checks.should_be_true,
            'Check Response Body Content':
                Checks.check_response_body_content,
            'Check JSON Value Not In Response Body':
@@ -329,6 +333,10 @@ class Checks:
                'params': ['dictionary', 'key'],
                'position': [0, 1]
            },
            'Dictionary Should Not Contain Key': {
                'params': ['dictionary', 'key'],
                'position': [0, 1]
            },
            'Should Not Be Empty': {
                'params': ['variable'],
                'position': [0]
@@ -337,6 +345,10 @@ class Checks:
                'params': ['expression'],
                'position': [0]
            },
            'Should Be True': {
                'params': ['expression'],
                'position': [0]
            },
            'Check JSON Value Not In Response Body': {
                'params': ['json_path_expr'],
                'position': [0]
@@ -532,6 +544,13 @@ class Checks:
        else:
            raise Exception(f"ERROR, Expected 'dictionary' and 'key' parameters but received: {kwargs}")
    
    @staticmethod
    def dictionary_should_not_contain_key(kwargs: list) -> str:
        if 'dictionary' in kwargs and 'key' in kwargs:
            return f"The dictionary `{kwargs['dictionary']}' should not contain the key '{kwargs['key']}'"
        else:
            raise Exception(f"ERROR, Expected 'dictionary' and 'key' parameters but received: {kwargs}")

    @staticmethod
    def check_context_response_body_content(kwargs: list) -> str:
        if 'expectation_filename' in kwargs and 'response_body' in kwargs:
Loading