Commit 0426ecdd authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Fixed some issues on create/onboarding/deletion of users and entities

parent 1919c103
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
#!/bin/bash

DOCKER_ROBOT_IMAGE=dockerhub.hi.inet/5ghacking/5gnow-robot-test-image
DOCKER_ROBOT_IMAGE_VERSION=4.0
DOCKER_ROBOT_IMAGE=labs.etsi.org:5050/ocf/robot-tests-image
DOCKER_ROBOT_IMAGE_VERSION=1.0
cd ..
REPOSITORY_BASE_FOLDER=${PWD}
TEST_FOLDER=$REPOSITORY_BASE_FOLDER/tests
+4 −1
Original line number Diff line number Diff line
@@ -22,3 +22,6 @@ class InterruptListener:

    def end_suite(self, name, attrs):
        print(f"Ending suite: {name}")


INTERRUPT_LISTENER=InterruptListener()
 No newline at end of file
+18 −17
Original line number Diff line number Diff line
@@ -437,6 +437,7 @@ Delete User At Register
    [Documentation]    (Administrator) This Keyword delete a user from register.
    [Arguments]    ${username}=${NONE}    ${uuid}=${NONE}
    ${user_uuid}=    Set Variable    ${uuid}
    ${environment_users}=   Set Variable   ${TRUE}

    IF    "${username}" != "${NONE}"
        ${user_uuid}=    Call Method    ${CAPIF_USERS}    get_user_uuid    ${username}
@@ -444,13 +445,16 @@ Delete User At Register

    IF   "${user_uuid}" == "${NONE}"
        ${user_uuid}=   Get User Uuid At Register    ${username}
        ${environment_users}=   Set Variable   ${FALSE}
    END

    ${resp}=    Delete User Admin Register Request   ${user_uuid}

    Should Be Equal As Strings    ${resp.status_code}    204

q
    IF   ${environment_users}
        Call Method    ${CAPIF_USERS}    remove_register_users_entry    ${user_uuid}
    END

    RETURN    ${resp}

@@ -458,7 +462,7 @@ Get List of Users At Register
    [Documentation]    (Administrator) This Keyword retrieve a list of users from register.
    ${headers}=    Create Register Admin Session    ${CAPIF_HTTPS_REGISTER_URL}    verify=False

    ${resp}=    DELETE On Session    register_session    /getUsers    headers=${headers}
    ${resp}=    GET On Session    register_session    /getUsers    headers=${headers}

    Should Be Equal As Strings    ${resp.status_code}    200

@@ -470,13 +474,16 @@ Get User Uuid At Register
    ${users}=   Get List of Users At Register

    # Find the first user with username indicated
    ${user}=    Evaluate    [item for item in ${users} if item['username'] == ${username}][0]    modules=collections
    ${user_uuid}=    Set Variable    &{EMPTY}
    FOR    ${user}   IN   @{users}
        IF   "${user['username']}" == "${username}"
            ${user_uuid}=    Set Variable   ${user['uuid']}
            BREAK
        END
    END

    ${user_uuid}=    Set Variable
    IF   ${user} == &{EMPTY}
    IF   "${user_uuid}" == "${EMPTY}"
        Log    ${username} not found in Register
    ELSE
        ${user_uuid}=    Set Variable   ${user['uuid']}
    END
    
    RETURN  ${user_uuid}    
@@ -558,15 +565,9 @@ Remove Resource
    ...    verify=ca.crt
    ...    username=${management_cert}

    Status Should Be    204    ${resp}

    &{body}=    Create Dictionary
    ...    password=password
    ...    username=${username}

    Create Session    jwtsession    ${CAPIF_HTTPS_REGISTER_URL}    verify=False    disable_warnings=1
    Run Keyword and Continue On Failure   Status Should Be    204    ${resp}

    ${resp}=    DELETE On Session    jwtsession    /remove    json=${body}
    Delete User At Register    username=${username}

    Should Be Equal As Strings    ${resp.status_code}    204

+1 −3
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ Library ArchiveLibrary
Library             OperatingSystem
Library             DateTime

Suite Teardown      Reset Testing Environment
Test Setup          Reset Testing Environment


@@ -99,14 +98,13 @@ Remove Dummy Invokers and Providers
        Log    ${username}=${entities_dictionary}[${username}]
        ${resource_url}=    Set Variable    ${entities_dictionary}[${username}][resource_url]
        ${management_cert}=    Set Variable    ${entities_dictionary}[${username}][management_cert]
        Run Keyword And Ignore Error    Remove Resource    ${resource_url.path}    ${management_cert}    ${username}
        Run Keyword And Continue On Failure    Remove Resource    ${resource_url.path}    ${management_cert}    ${username}
    END

    ${result}=    Run Process    ls    -l

    Log Many    ${result.stdout}


*** Keywords ***
Get Provider
    [Arguments]    ${index}    ${entities_dictionary}
+1 −2
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ Library OperatingSystem
Library             DateTime
Library             String

Suite Teardown      Reset Testing Environment


*** Variables ***
@@ -19,7 +18,7 @@ ${TOTAL_USERS} 5

${BACKUP_DIRECTORY}                 backup
${RESULT_FOLDER}                    /opt/robot-tests/results
${OUTPUT_ZIP_FILE}                  entities_loaded.zip
${OUTPUT_ZIP_FILE}                  users_loaded.zip

${USER_PASSWORD}                    password
${USERNAME_PREFIX}                  user