Add test case for user list
The randomnes of the user creation is per instance
of the test. We are running set of use cases which
is generating random strings but not that random
as a whole in the test.
The test leaves a whole lot of user created entries
on the BMC. This change cleanup user list created
from BMC
Resolves openbmc/openbmc-test-automation#122
Change-Id: I96711cbf598b10c8c156630bb825c03e069196b1
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_user.robot b/tests/test_user.robot
index e28fedb..ae64cde 100755
--- a/tests/test_user.robot
+++ b/tests/test_user.robot
@@ -1,6 +1,12 @@
*** Settings ***
Documentation This suite is for testing Open BMC user account management.
+... The randomness of the string generated is limited to the
+... instance per test case however we end up running multiple
+... test and multiple iteration. This creates scenario where
+... the same previous user is generated.
+... As a good pratice, clean up all the users at the end of
+... test.
Resource ../lib/rest_client.robot
Resource ../lib/utils.robot
@@ -152,7 +158,7 @@
Set password with empty password for existing
[Documentation] ***GOOD PATH***
- ... This testcase is to verify that empty password can be set
+ ... This testcase is to verify that empty password can be set
... for a existing user.\n
${username} = Generate Random String ${RANDOM_STRING_LENGTH}
@@ -240,6 +246,19 @@
${usergroup_list} = Get GroupListUsr
Should Not Contain ${usergroup_list} ${EMPTY}
+Cleanup Users List
+ [Documentation] ***GOOD PATH***
+ ... This testcase is to clean up multiple users created by
+ ... the test so as to leave the system in cleaner state.
+ ... This is a no-op if there is no user list on the BMC.
+ [Tags] CleanupUsersList
+
+ ${user_list} = Get UserList
+ : FOR ${username} IN @{user_list}
+ \ ${resp} = Delete User ${username}
+ \ Should Be Equal ${resp} ok
+
+
*** Keywords ***
Get UserList