Fix depecrating robot syntax in test suites
Changes:
- Run KeyWord If is deprecated since Robot
Framework version 5.*, use IF instead
- Keyword name Redfish.login does not follow case convention
- TEMPLATE is in wrong place of Test Case.
Recommended order of elements in Test Cases:
DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
Tested:
- Ran dry-run test
Change-Id: I7b861ea1f90b86f57a483b97d40d3104dc789cdb
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/account_service/test_ipmi_redfish_user.robot b/redfish/account_service/test_ipmi_redfish_user.robot
index 00176f8..79b0eed 100644
--- a/redfish/account_service/test_ipmi_redfish_user.robot
+++ b/redfish/account_service/test_ipmi_redfish_user.robot
@@ -282,8 +282,9 @@
Run IPMI Standard Command user enable ${random_userid}
# Set given privilege and enable IPMI messaging for newly created user.
- Run Keyword If '${privilege}' != '0'
- ... Set Channel Access ${random_userid} ipmi=on privilege=${privilege}
+ IF '${privilege}' != '0'
+ Set Channel Access ${random_userid} ipmi=on privilege=${privilege}
+ END
RETURN ${random_username} ${random_userid}
@@ -335,5 +336,5 @@
IF ${is_empty} == ${True} BREAK
END
- Run Keyword If '${jj}' == '299' Fail msg=A free user ID could not be found.
+ IF '${jj}' == '299' Fail msg=A free user ID could not be found.
RETURN ${random_userid}
diff --git a/redfish/account_service/test_ldap_configuration.robot b/redfish/account_service/test_ldap_configuration.robot
index 074dc17..0338772 100644
--- a/redfish/account_service/test_ldap_configuration.robot
+++ b/redfish/account_service/test_ldap_configuration.robot
@@ -766,8 +766,11 @@
${power_status}= Redfish.Get Attribute /redfish/v1/Chassis/${CHASSIS_ID} PowerState
Return From Keyword If '${power_status}' == '${expected_power_status}'
- Run Keyword If '${power_status}' == 'Off' Redfish Power On
- ... ELSE Redfish Power Off
+ IF '${power_status}' == 'Off'
+ Redfish Power On
+ ELSE
+ Redfish Power Off
+ END
Update LDAP User Role And Host Poweroff
[Documentation] Update LDAP user role and do host poweroff.
diff --git a/redfish/account_service/test_user_account.robot b/redfish/account_service/test_user_account.robot
index 5ba7843..166d6b1 100644
--- a/redfish/account_service/test_user_account.robot
+++ b/redfish/account_service/test_user_account.robot
@@ -578,9 +578,14 @@
Bmc Execute Command ${cmd}
# Verify login with created user.
- ${status}= Run Keyword If '${login_check}' == '${True}'
- ... Verify Redfish User Login ${username} ${password}
- Run Keyword If '${login_check}' == '${True}' Should Be Equal ${status} ${enabled}
+ IF '${login_check}' == '${True}'
+ ${status}= Run Keyword And Return Status
+ ... Verify Redfish User Login ${username} ${password}
+ ELSE
+ ${status}= Set Variable ${False}
+ END
+
+ IF '${login_check}' == '${True}' Should Be Equal ${status} ${enabled}
# Validate Role ID of created user.
${role_config}= Redfish_Utils.Get Attribute
@@ -754,18 +759,20 @@
# Patch basicauth to TRUE
Configure AuthMethods ${auth_method}=${TRUE}
- Run Keyword IF "${auth_method}" == "XToken"
- ... Check XToken Works Fine ${HTTP_OK}
- ... ELSE
- ... Check BasicAuth Works Fine ${HTTP_OK}
+ IF "${auth_method}" == "XToken"
+ Check XToken Works Fine ${HTTP_OK}
+ ELSE
+ Check BasicAuth Works Fine ${HTTP_OK}
+ END
# Patch basicauth to FALSE
Configure AuthMethods ${auth_method}=${FALSE}
- Run Keyword IF "${auth_method}" == "BasicAuth"
- ... Check BasicAuth Works Fine ${HTTP_UNAUTHORIZED}
- ... ELSE
- ... Check XToken Works Fine ${HTTP_UNAUTHORIZED}
+ IF "${auth_method}" == "BasicAuth"
+ Check BasicAuth Works Fine ${HTTP_UNAUTHORIZED}
+ ELSE
+ Check XToken Works Fine ${HTTP_UNAUTHORIZED}
+ END
Configure AuthMethods
[Documentation] Enable/disable authmethod types.
diff --git a/redfish/service_root/test_sessions_management.robot b/redfish/service_root/test_sessions_management.robot
index 0bde4f9..c933b54 100644
--- a/redfish/service_root/test_sessions_management.robot
+++ b/redfish/service_root/test_sessions_management.robot
@@ -24,7 +24,8 @@
*** Test Cases ***
Create Session And Verify Response Code Using Different Credentials
- [Documentation] Create session and verify response code using different credentials.
+ [Documentation] Create session and verify response code using different
+ ... credentials.
[Tags] Create_Session_And_Verify_Response_Code_Using_Different_Credentials
[Template] Create Session And Verify Response Code
@@ -37,7 +38,8 @@
Create Session And Verify Response Code Using Operator Credentials
- [Documentation] Create session and verify response code using operator credentials.
+ [Documentation] Create session and verify response code using operator
+ ... credentials.
[Tags] Create_Session_And_Verify_Response_Code_Using_Operator_Credentials
[Template] Create Session And Verify Response Code
@@ -65,10 +67,11 @@
Set Session Timeout And Verify Session After Timeout
- [Documentation] Set timeout for session service and verify session is deleted after timeout.
+ [Documentation] Set timeout for session service and verify session is
+ ... deleted after timeout.
[Tags] Set_Session_Timeout_And_Verify_Session_After_Timeout
- [Teardown] Set Session Timeout And Verify ${Default_Timeout_Value} ${HTTP_OK}
[Template] Set Session Timeout And Verify Session Deleted After Timeout
+ [Teardown] Set Session Timeout And Verify ${Default_Timeout_Value} ${HTTP_OK}
#timeout Value
${30}
@@ -76,7 +79,8 @@
Verify Session Login And Logout For Newly Created User
- [Documentation] Verify able to login and logout using the session created for new user.
+ [Documentation] Verify able to login and logout using the session created
+ ... for new user.
[Tags] Verify_Session_Login_And_Logout_For_Newly_Created_User
[Teardown] Redfish.Login
@@ -235,8 +239,9 @@
${session_timeout}= Redfish.Get Attribute
... ${REDFISH_BASE_URI}SessionService SessionTimeout
- Run Keyword If ${valid_status_code}==${HTTP_OK}
- ... Valid Value session_timeout [${value}]
+ IF ${valid_status_code}==${HTTP_OK}
+ Valid Value session_timeout [${value}]
+ END
Create Session And Check Session Timeout
@@ -254,7 +259,7 @@
Redfish.Get ${REDFISH_SESSION} valid_status_codes=[${HTTP_UNAUTHORIZED}]
# Since sessions will deleted so logging again.
- Redfish.login
+ Redfish.Login
${session_list}= Redfish.Get Members List /redfish/v1/SessionService/Sessions
List Should Not Contain Value ${session_list} ${session_id}
@@ -286,11 +291,11 @@
Redfish.Login
# Skip operator user if SKIP_OPERATOR_USER is 1.
- Run Keyword If
- ... ${SKIP_OPERATOR_USER} == ${1}
- ... Set Suite Variable &{USERS} Administrator=${ADMIN}
- ... ELSE
- ... Set Suite Variable &{USERS} Administrator=${ADMIN} Operator=${OPERATOR}
+ IF ${SKIP_OPERATOR_USER} == ${1}
+ Set Suite Variable &{USERS} Administrator=${ADMIN}
+ ELSE
+ Set Suite Variable &{USERS} Administrator=${ADMIN} Operator=${OPERATOR}
+ END
Create Users With Different Roles users=${USERS} force=${True}
Get Default Timeout Value
diff --git a/redfish/test_xit.robot b/redfish/test_xit.robot
index 6bcd13a..318f1bf 100644
--- a/redfish/test_xit.robot
+++ b/redfish/test_xit.robot
@@ -27,9 +27,10 @@
Log To Console ${resp}
- Run Keyword If '${resp.status}' == '${HTTP_OK}'
- ... Should Be Equal As Strings ${resp.dict["Members@odata.count"]} 0
- ... msg=${resp.dict["Members@odata.count"]} dumps exist.
+ IF '${resp.status}' == '${HTTP_OK}'
+ Should Be Equal As Strings ${resp.dict["Members@odata.count"]} 0
+ ... msg=${resp.dict["Members@odata.count"]} dumps exist.
+ END
Check For Regex In Journald ${ERROR_REGEX} error_check=${0} boot=-b filter_string=${SKIP_ERROR}