Redfish userid privilege tests
Added test scenario:
- 1) Create a redfish user with admin privilege role and
verify its successfully created
- 2) Create a redfish user with operator privilege role and
verify its successfully created
- 3) Create a redfish user with user privilege role and
verify its successfully created
- 4) Create a redfish user with callback privilege role and
verify its successfully created
Change-Id: I7678155625fed8743218be20ca2d7eb7bef9aa52
Signed-off-by: Sandhya Somashekar <sansomas@in.ibm.com>
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/account_service/test_user_account.robot b/redfish/account_service/test_user_account.robot
index a81feb6..ca89440 100644
--- a/redfish/account_service/test_user_account.robot
+++ b/redfish/account_service/test_user_account.robot
@@ -18,6 +18,16 @@
${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled
Should Be Equal As Strings ${resp} ${True}
+Redfish Create and Verify Users
+ [Documentation] Create Redfish users with various roles
+ [Tags] Redfish_Create_and_Verify_Users
+ [Template] Redfish Create And Verify User
+
+ # username password role_id enabled
+ admin_user TestPwd123 Administrator ${True}
+ operator_user TestPwd123 Operator ${True}
+ user_user TestPwd123 User ${True}
+ callback_user TestPwd123 Callback ${True}
*** Keywords ***
@@ -32,3 +42,52 @@
FFDC On Test Case Fail
Redfish.Logout
+
+Redfish Create And Verify User
+ [Documentation] Redfish create and verify user.
+ [Arguments] ${username} ${password} ${role_id} ${enabled}
+
+ # Description of argument(s):
+ # Username The username to be created
+ # Password The password to be assigned
+ # Roleid The role id of the user to be created
+ # Enabled The decision if it should be enabled
+
+ # Example:
+ #{
+ #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
+ #"@odata.id": "/redfish/v1/AccountService/Accounts/test1",
+ #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount",
+ #"Description": "User Account",
+ #"Enabled": true,
+ #"Id": "test1",
+ #"Links": {
+ # "Role": {
+ # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
+ # }
+ #},
+
+ # Delete if the user exist.
+ Run Keyword And Ignore Error
+ ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName}
+
+ # Create specified user.
+ ${payload}= Create Dictionary
+ ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled}
+ Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload}
+ ... valid_status_codes=[${HTTP_CREATED}]
+
+ Redfish.Logout
+
+ # Login with created user.
+ Redfish.Login ${username} ${password}
+
+ # Validate Role Id of created user.
+ ${role_config}= Redfish_Utils.Get Attribute
+ ... /redfish/v1/AccountService/Accounts/${userName} RoleId
+ Should Be Equal ${role_id} ${role_config}
+
+ Redfish.Get /redfish/v1/AccountService/Accounts/${userName}
+
+ # Delete Specified User
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${userName}