Commit 23534279 authored by Claudia Carballo Gonzalez's avatar Claudia Carballo Gonzalez
Browse files

Adding new tests for Visibility Control API

parent a045129a
Loading
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ Create Visibility Control Rule
    
    Length Should Be    ${resp.json()['rules']}    0


Get Visibility Control Rule by AMF Provider
    [Tags]    visibility_control-4

@@ -232,3 +233,53 @@ Create Update and Delete Visibility Control Rule by AMF Provider

    Length Should Be    ${resp.json()['rules']}    0

Create and Get Specific Visibility Control Rule
    [Tags]    visibility_control-8
    
    # 1. Prepare the request body
    ${body}=    Create Visibility Control Rule Body
    
    # 2. Create a new rule using superadmin
    ${resp}=    Post Request Capif
    ...    /helper/visibility-control/rules
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}
    ...    json=${body}

    # Verify creation was successful (201 Created)
    Status Should Be    201    ${resp}
    ${rule_id}=    Set Variable    ${resp.json()['ruleId']}

    # 3. Get the specific rule by its ID
    ${resp}=    Get Request Capif
    ...    /helper/visibility-control/rules/${rule_id}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}

    # Validation: Specific GET returns the rule object directly.
    # We verify the status is 200 OK and the ruleId matches.
    Status Should Be    200    ${resp}
    Should Be Equal As Strings    ${resp.json()['ruleId']}    ${rule_id}
    
    # 4. Delete the specific rule
    ${resp}=    Delete Request Capif
    ...    /helper/visibility-control/rules/${rule_id}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}

    # Verify deletion was successful (204 No Content)
    Status Should Be    204    ${resp}

    # 5. Verify the rule no longer exists
    ${resp}=    Get Request Capif
    ...    /helper/visibility-control/rules/${rule_id}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}
    
    # After deletion, the server must return 404 Not Found.
    # This is the correct way to confirm the resource is gone.
    Status Should Be    404    ${resp}