Commit 451a6557 authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Minor fix on visbility control tests

parent ad74d314
Loading
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ Discover Published service APIs by Unauthorised API Invoker Visibility Control (

    # Verify creation was successful (201 Created)
    Status Should Be    201    ${resp}
    ${rule_id}=    Set Variable    ${resp.json()['ruleId']}
    ${rule_id_1}=    Set Variable    ${resp.json()['ruleId']}
    Dictionary Should Contain Key    ${resp.json()}    providerSelector
    Should Not Be Empty    ${resp.json()['providerSelector']}

@@ -531,7 +531,7 @@ Discover Published service APIs by Unauthorised API Invoker Visibility Control (

    # Verify creation was successful (201 Created)
    Status Should Be    201    ${resp}
    ${rule_id}=    Set Variable    ${resp.json()['ruleId']}
    ${rule_id_2}=    Set Variable    ${resp.json()['ruleId']}
    Dictionary Should Contain Key    ${resp.json()}    providerSelector
    Should Not Be Empty    ${resp.json()['providerSelector']}

@@ -550,6 +550,23 @@ Discover Published service APIs by Unauthorised API Invoker Visibility Control (
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    1
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published}

    # Cleanup: Delete the rules
    ${resp}=    Delete Request Capif
    ...    /helper/visibility-control/rules/${rule_id_1}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}

    Status Should Be    204    ${resp}

    ${resp}=    Delete Request Capif
    ...    /helper/visibility-control/rules/${rule_id_2}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}

    Status Should Be    204    ${resp}

# ==========
Discover Published service APIs by Unauthorised API Invoker Visibility Control (update the rule and see changes in the discovery process)
    [Tags]    visibility_control-12
+12 −6
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ def create_visibility_control_rule_body_invalid_dates():
        "providerSelector": {
            "apiName": ["api-test-error"],
            "userName": "AMF_ROBOT_TESTING_PROVIDER"
        }
        },
        "notes": "ROBOT_TESTING"
    }


@@ -24,7 +25,8 @@ def create_visibility_control_rule_body():
            "apiName": ["api-test-cli"],
            "apiProviderId": ["capif-prov-01"],
            "userName": "AMF_ROBOT_TESTING_PROVIDER"
        }
        },
        "notes": "ROBOT_TESTING"
    }

def create_visibility_control_rule_body_2():
@@ -40,7 +42,8 @@ def create_visibility_control_rule_body_2():
            "apiName": ["api-test-cli"],
            "apiProviderId": ["capif-prov-01"],
            "userName": "AMF_ROBOT_TESTING_PROVIDER"
        }
        },
        "notes": "ROBOT_TESTING"
    }

def create_visibility_control_rule_body_3(invoker_ids=None, provider_selector=None):
@@ -64,7 +67,8 @@ def create_visibility_control_rule_body_3(invoker_ids=None, provider_selector=No
        "invokerExceptions": {
            "apiInvokerId": invoker_ids
        },
        "providerSelector": provider_selector or {}
        "providerSelector": provider_selector or {},
        "notes": "ROBOT_TESTING"
    }

def create_visibility_control_rule_body_4(invoker_ids=None, provider_selector=None):
@@ -88,7 +92,8 @@ def create_visibility_control_rule_body_4(invoker_ids=None, provider_selector=No
        "invokerExceptions": {
            "apiInvokerId": invoker_ids
        },
        "providerSelector": provider_selector or {}
        "providerSelector": provider_selector or {},
        "notes": "ROBOT_TESTING"
    }

def create_visibility_control_rule_body_5(invoker_ids=None, provider_selector=None):
@@ -112,7 +117,8 @@ def create_visibility_control_rule_body_5(invoker_ids=None, provider_selector=No
        "invokerExceptions": {
            "apiInvokerId": invoker_ids
        },
        "providerSelector": provider_selector or {}
        "providerSelector": provider_selector or {},
        "notes": "ROBOT_TESTING"
    }

# def create_test_api_description(api_id="test-api-001", api_name="test-api", provider_name="capif-prov-01", aef_id="aef-001"):
+24 −0
Original line number Diff line number Diff line
@@ -630,6 +630,30 @@ Clean Test Information
        Delete User At Register    uuid=${uuid}
    END

    ${resp}=    Get Request Capif
    ...    /helper/visibility-control/rules
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}

    ${rules_size}=    Get Length    ${resp.json()['rules']}
    IF  ${rules_size} > 0
        Log    There are ${rules_size} rules in visibility control, removing ROBOT_TESTING rules if present
        FOR    ${rule}    IN    @{resp.json()['rules']}
            ${notes}=    Get From Dictionary    ${rule}    notes   NOT REMOVE
            IF   "${notes}" == "ROBOT_TESTING"
                Log    Removing rule ${rule['ruleId']}
                ${rule_id}=    Get From Dictionary    ${rule}    ruleId
                ${resp_delete}=    Delete Request Capif
                ...    /helper/visibility-control/rules/${rule_id}
                ...    server=${CAPIF_HTTPS_URL}
                ...    verify=ca.crt
                ...    username=${SUPERADMIN_USERNAME}
                Status Should Be    204    ${resp_delete}
            END
        END
    END

Remove entity
    [Arguments]    ${entity_user}    ${certificate_name}=${entity_user}