Test to verify admin and readonly user invalid password format

Changes:
- Added two new testcases to verify invalid password format
  for admin and readonly user via Redfish

Tested:
Tested changes on BMC environment

Change-Id: I3cc396f38a84a0936b103dfe0bf5c719eb78b644
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/redfish/account_service/test_user_account.robot b/redfish/account_service/test_user_account.robot
index f2eeef1..76ccac1 100644
--- a/redfish/account_service/test_user_account.robot
+++ b/redfish/account_service/test_user_account.robot
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Test Redfish user account.
+Documentation    Test suite for verifying Redfish admin, readonly operation user accounts.
 
 Resource         ../../lib/resource.robot
 Resource         ../../lib/bmc_redfish_resource.robot
@@ -17,7 +17,7 @@
 ${account_lockout_threshold}  ${3}
 ${ssh_status}                 ${True}
 
-** Test Cases **
+*** Test Cases ***
 
 Verify AccountService Available
     [Documentation]  Verify Redfish account service is available.
@@ -71,7 +71,6 @@
     # Verify users after reboot.
     Redfish Verify User  readonly_user  TestPwd123  ReadOnly        ${True}
 
-
 Redfish Create and Verify Admin User
     [Documentation]  Create a Redfish user with administrator role and verify.
     [Tags]  Redfish_Create_and_Verify_Admin_User
@@ -99,28 +98,31 @@
     readonly_user  TestPwd123  ReadOnly        ${True}
 
 
-Verify Redfish Admin User With Wrong Password
-    [Documentation]  Verify Redfish admin user with wrong password.
-    [Tags]  Verify_Redfish_Admin_User_With_Wrong_Password
-    [Template]  Verify Redfish User with Wrong Password
+Verify Redfish Admin User Login With Wrong Password
+    [Documentation]  Verify Redfish create admin user with valid password and make sure
+    ...  admin user failed to login with wrong password.
+    [Tags]  Verify_Redfish_Admin_User_Login_With_Wrong_Password
+    [Template]  Verify Redfish User Login With Wrong Password
 
     #username      password    role_id         enabled  wrong_password
     admin_user     TestPwd123  Administrator   ${True}  alskjhfwurh
 
 
-Verify Redfish Operator User with Wrong Password
-    [Documentation]  Verify Redfish operator user with wrong password.
-    [Tags]  Verify_Redfish_Operator_User_with_Wrong_Password
-    [Template]  Verify Redfish User with Wrong Password
+Verify Redfish Operator User Login With Wrong Password
+    [Documentation]  Verify Redfish create operator user with valid password and make sure
+    ... operator user failed to login with wrong password.
+    [Tags]  Verify_Redfish_Operator_User_Login_With_Wrong_Password
+    [Template]  Verify Redfish User Login With Wrong Password
 
     #username      password    role_id         enabled  wrong_password
     operator_user  TestPwd123  Operator        ${True}  12j8a8uakjhdaosiruf024
 
 
-Verify Redfish Readonly User With Wrong Password
-    [Documentation]  Verify Redfish readonly user with wrong password.
-    [Tags]  Verify_Redfish_Readonly_User_With_Wrong_Password
-    [Template]  Verify Redfish User with Wrong Password
+Verify Redfish Readonly User Login With Wrong Password
+    [Documentation]  Verify Redfish create readonly user with valid password and make sure
+    ...  readonly user failed to login with wrong password.
+    [Tags]  Verify_Redfish_Readonly_User_Login_With_Wrong_Password
+    [Template]  Verify Redfish User Login With Wrong Password
 
     #username      password    role_id         enabled  wrong_password
     readonly_user  TestPwd123  ReadOnly        ${True}  12
@@ -540,6 +542,41 @@
     BasicAuth
     XToken
 
+
+Redfish Create and Verify Admin User With Invalid Password Format
+    [Documentation]  Create a admin user with invalid password format and verify.
+    [Template]  Create User With Unsupported Password Format And Verify
+    [Tags]  Redfish_Create_and_Verify_Admin_User_With_Invalid_Password_Format
+
+    #username       role_id        password
+    admin_user      Administrator  snellens
+    admin_user      Administrator  10000001
+    admin_user      Administrator  12345678
+    admin_user      Administrator  abcdefgh
+    admin_user      Administrator  abf12345
+    admin_user      Administrator  helloworld
+    admin_user      Administrator  HELLOWORLD
+    admin_user      Administrator  &$%**!*@
+    admin_user      Administrator  Dictation
+
+
+Redfish Create and Verify Readonly User With Invalid Password Format
+    [Documentation]  Create a readonly user with invalid password format and verify.
+    [Template]  Create User With Unsupported Password Format And Verify
+    [Tags]  Redfish_Create_and_Verify_Readonly_User_With_Invalid_Password_Format
+
+    #username       role_id        password
+    readonly_user   ReadOnly       snellens
+    readonly_user   ReadOnly       10000001
+    readonly_user   ReadOnly       12345678
+    readonly_user   ReadOnly       abcdefgh
+    readonly_user   ReadOnly       abf12345
+    readonly_user   ReadOnly       helloworld
+    readonly_user   ReadOnly       HELLOWORLD
+    readonly_user   ReadOnly       &$%**!*@
+    readonly_user   ReadOnly       Dictation
+
+
 *** Keywords ***
 
 Test Teardown Execution
@@ -668,8 +705,8 @@
     # Delete Specified User
     Redfish.Delete  /redfish/v1/AccountService/Accounts/${username}
 
-Verify Redfish User with Wrong Password
-    [Documentation]  Verify Redfish User with Wrong Password.
+Verify Redfish User Login With Wrong Password
+    [Documentation]  Verify Redfish User failed to login with wrong password.
     [Arguments]   ${username}  ${password}  ${role_id}  ${enabled}  ${wrong_password}
 
     # Description of argument(s):
@@ -878,3 +915,30 @@
 
     #  Check the response of curl command is 200/401
     Should Contain  ${out}  ${status_code}
+
+
+Create User With Unsupported Password Format And Verify
+   [Documentation]  Create admin or readonly user with unsupported password format
+   ...  and verify.
+   [Arguments]   ${username}  ${role_id}  ${password}
+
+   # Description of argument(s):
+   # username            The username to be created.
+   # role_id             The role ID of the user to be created
+   #                     (e.g. "Administrator", "ReadOnly").
+   # password            The password to be assigned.
+   #                     Unsupported password format are sequential characters,
+   #                     sequential digits, palindrome digits, palindrome characters,
+   #                     only uppercase letters, only lowercase letters, only digits,
+   #                     only characters, not a dictionary word.
+
+
+   # Make sure the user account in question does not already exist.
+    Redfish.Delete  /redfish/v1/AccountService/Accounts/${userName}
+    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
+
+   # Create specified user with invalid password format.
+   ${payload}=  Create Dictionary
+   ...  UserName=${username}  Password=${password}  RoleId=${role_id}  Enabled=${True}
+   Redfish.Post  /redfish/v1/AccountService/Accounts/  body=&{payload}
+   ...  valid_status_codes=[${HTTP_BAD_REQUEST}]