Commit 4ccdc032 authored by Benedetta Arena's avatar Benedetta Arena
Browse files

fix: improve tests logic

parent 49ab68ef
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -25,26 +25,26 @@ IOP_CNF_01_01 Create Entity In B1 And Retrieve Entity In All Brokers
    [Tags]    6_1    I6_1_1_1    inclusive    exclusive    interoperability

    ${expected_payload}=    Load Entity    ${entity_payload_filename}    ${entity_id}
    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b1_url}    context=${ngsild_test_suite_context}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}
    
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b1_url}
    Check Response Status Code    200    ${response.status_code}
    Should Be Equal    ${response.json()}    ${expected_payload}

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b2_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b2_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    availableSpotsNumber
    Should Contain    ${response.json()}    totalSpotsNumber
    Should Not Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b3_url}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b3_url}
    Check Response Status Code    404    ${response.status_code}

*** Keywords ***
Setup Initial Context Source Registrations

    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}

    ${registration_id1}=     Generate Random CSR Id
    Set Suite Variable    ${registration_id1}
@@ -71,6 +71,4 @@ Setup Initial Context Source Registrations
Delete Entities And Delete Registrations
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b2_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b3_url}
 No newline at end of file
    Delete Entity by Id    ${entity_id}    broker_url=${b1_url}
 No newline at end of file
+6 −8
Original line number Diff line number Diff line
@@ -26,25 +26,25 @@ IOP_CNF_01_02 Create Entity In B1 And Retrieve Entity In All Brokers
    [Documentation]    Check that, in b1 and b2, the entity does not contain the attribute location, said attribute will be contained in b3 thanks to an exclusive registration.
    [Tags]    6_1    I6_1_1_2    inclusive    exclusive    interoperability

    ${response}=    Retrieve Entity by Id    ${entity_id}    context=${ngsild_test_suite_context}    broker_url=${b1_url}    local=true
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b1_url}    local=true
    Check Response Status Code    200    ${response.status_code}
    Should Not Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    context=${ngsild_test_suite_context}    broker_url=${b2_url}    local=true
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b2_url}    local=true
    Check Response Status Code    200    ${response.status_code}
    Should Not Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    context=${ngsild_test_suite_context}    broker_url=${b3_url}    local=true
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b3_url}    local=true
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    location

*** Keywords ***
Setup Initial Context Source Registrations

    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}

    ${registration_id1}=     Generate Random CSR Id
    Set Suite Variable    ${registration_id1}
@@ -72,5 +72,3 @@ Delete Entities And Delete Registrations
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b2_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b3_url}
+8 −11
Original line number Diff line number Diff line
@@ -25,30 +25,30 @@ IOP_CNF_02_01 Create Entity In B1 And Retrieve Entity In All Brokers
    [Documentation]    Check that entities are created in the brokers, b1 and b2 should contain most entity attributes, 3b and b4 should only contain the location attribute.
    [Tags]    6_1    I6_1_2_1    inclusive    redirect    interoperability

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b1_url}    context=${ngsild_test_suite_context}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}
    
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b1_url}
    Check Response Status Code    200    ${response.status_code}
    Should Not Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b2_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b2_url}
    Check Response Status Code    200    ${response.status_code}
    Should Not Contain    ${response.json()}    location
    Should Not Contain    ${response.json()}    name

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b3_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b3_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b4_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b4_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    location

*** Keywords ***
Setup Initial Context Source Registrations

    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}
    
    ${registration_id1}=     Generate Random CSR Id
    Set Suite Variable    ${registration_id1}
@@ -88,6 +88,3 @@ Delete Entities And Delete Registrations
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id3}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b1_url}
 No newline at end of file
    Delete Entity By Id    ${entity_id}    broker_url=${b2_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b3_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b4_url}
 No newline at end of file
+9 −12
Original line number Diff line number Diff line
@@ -26,30 +26,30 @@ IOP_CNF_02_02 Create Entity In B1 And Retrieve Entity In All Brokers
    [Documentation]    Check that entities are created in the brokers, b1 and b2 should contain most entity attributes, 3b and b4 should only contain the location attribute.
    [Tags]    6_1    I6_1_2_2    inclusive    redirect    interoperability

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b1_url}    context=${ngsild_test_suite_context}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b1_url}
    Check Response Status Code    200    ${response.status_code}
    Should Not Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b2_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b2_url}
    Check Response Status Code    200    ${response.status_code}
    Should Not Contain    ${response.json()}    location
    Should Not Contain    ${response.json()}    name

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b3_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b3_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    location

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b4_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b4_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    location

*** Keywords ***
Setup Initial Context Source Registrations
    
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}

    ${registration_id1}=     Generate Random CSR Id
    Set Suite Variable    ${registration_id1}
@@ -89,6 +89,3 @@ Delete Entities And Delete Registrations
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id3}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b1_url}
 No newline at end of file
    Delete Entity By Id    ${entity_id}    broker_url=${b2_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b3_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b4_url}
 No newline at end of file
+8 −12
Original line number Diff line number Diff line
@@ -26,27 +26,25 @@ IOP_CNF_03_01 Create Entity In B1 And Retrieve Entity In All Brokers
    [Documentation]    Check that entities are created in b1 and b3. The entity is not present in b2 and in b4 there are only some attributes.
    [Tags]    6_1    I6_1_3_1    auxiliary    inclusive    interoperability

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b1_url}    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b2_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b1_url}
    Check Response Status Code    200    ${response.status_code}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b2_url}
    Check Response Status Code    404    ${response.status_code}

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b3_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b3_url}
    Check Response Status Code    200    ${response.status_code}

    ${response}=    Retrieve Entity by Id    ${entity_id}    local=true    broker_url=${b4_url}    context=${ngsild_test_suite_context}
    ${response}=    Retrieve Entity    ${entity_id}    local=true    broker_url=${b4_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain    ${response.json()}    availableSpotsNumber
    Should Contain    ${response.json()}    totalSpotsNumber

*** Keywords ***
Setup Initial Context Source Registrations

    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    201    ${response.status_code}
    
    ${registration_id1}=     Generate Random CSR Id
    Set Suite Variable    ${registration_id1}
@@ -86,5 +84,3 @@ Delete Entities And Delete Registrations
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id3}    broker_url=${b1_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b1_url}
 No newline at end of file
    Delete Entity By Id    ${entity_id}    broker_url=${b3_url}
    Delete Entity By Id    ${entity_id}    broker_url=${b4_url}
 No newline at end of file
Loading