Added new test for Expired password menu
Changes:
- Added test "Expire_And_Change_Admin_User_Password_Via_Redfish_And_Verify"
- Added keyword "Restore Default Password For Admin User"
Tested:
- Ran successfully test_bmc_expire_password.robot
Change-Id: Ie8dc0dc991e6cd1fe37e3d4a23d33cc57700c2c1
Signed-off-by: Megha G N <Megha.G.N@ibm.com>
diff --git a/security/test_bmc_expire_password.robot b/security/test_bmc_expire_password.robot
index a771b78..f6e69e4 100644
--- a/security/test_bmc_expire_password.robot
+++ b/security/test_bmc_expire_password.robot
@@ -236,11 +236,8 @@
Expire Password ${admin_user}
Redfish.Login
- ${status}= Run Keyword And Return Status
- ... Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME}
- ... body={'Password': '0penBmc0penBmc0penBmc'}
- Should Be Equal ${status} ${False}
+ Set Password Via Redfish 0penBmc0penBmc0penBmc ${False}
Verify Error While Creating User With Expired Admin Password
@@ -267,9 +264,7 @@
Expire Password ${admin_user}
- ${status}= Run Keyword And Return Status
- ... Redfish.Patch /redfish/v1/AccountService/Accounts/${admin_user}
- ... body={'Password': '${admin_password}'}
+ Set Password Via Redfish ${admin_password} ${True}
# Reboot BMC.
Redfish OBMC Reboot (off) stack_mode=skip
@@ -278,6 +273,24 @@
Redfish.Login ${admin_user} ${admin_password}
+Expire And Change Admin User Password Via Redfish And Verify
+ [Documentation] Expire and change admin user password via Redfish and verify.
+ [Tags] Expire_And_Change_Admin_User_Password_Via_Redfish_And_Verify
+ [Setup] Redfish Create User ${admin_user} ${default_adminuser_passwd} Administrator ${True}
+ [Teardown] Restore Default Password For Admin User
+
+ Expire Password ${admin_user}
+
+ Verify User Password Expired Using Redfish ${admin_user} ${default_adminuser_passwd}
+
+ # Change to a valid password.
+ Set Password Via Redfish AdminUser2 ${True}
+ Redfish.Logout
+
+ # Verify login with the new password.
+ Redfish.Login ${admin_user} AdminUser2
+
+
*** Keywords ***
Set Account Lockout Threshold
@@ -343,3 +356,18 @@
... body={'Password': '${default_adminuser_passwd}'} valid_status_codes=[${HTTP_OK}]
# Verify that admin user is able to run Redfish command using default password.
Redfish.Logout
+
+
+Set Password Via Redfish
+ [Documentation] Set new password via redfish.
+ [Arguments] ${new_password} ${expect_result}
+
+ # Description of argument(s):
+ # new_password New password set.
+ # expect_result Expected result (eg:true or false).
+
+ ${status}= Run Keyword And Return Status
+ ... Redfish.Patch /redfish/v1/AccountService/Accounts/${admin_user}
+ ... body={'Password': '${new_password}'}
+
+ Should be Equal ${status} ${expect_result}