Test Delete Redfish Response Codes
Changes:
- Added test to test response DELETE code HTTP_METHOD_NOT_ALLOWED
- Minor fixes
Change-Id: I6deb43ce593643ac595dabe8e9d31edb03896964
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/redfish_client.robot b/lib/redfish_client.robot
index badb389..b8e3aa3 100644
--- a/lib/redfish_client.robot
+++ b/lib/redfish_client.robot
@@ -53,7 +53,7 @@
[Arguments] ${uri_suffix}
... ${session_id}=${None}
... ${xauth_token}=${None}
- ... ${response_format}="json"
+ ... ${resp_check}=${1}
... ${timeout}=30
# Description of argument(s):
@@ -61,8 +61,7 @@
# (e.g. 'Systems').
# session_id Session id.
# xauth_token Authentication token.
- # response_format The format desired for data returned by this keyword
- # (json/HTTPS response).
+ # resp_check By default check the response status and return JSON.
# timeout Timeout in seconds to establish connection with URI.
${base_uri} = Catenate SEPARATOR= ${REDFISH_BASE_URI} ${uri_suffix}
@@ -84,7 +83,7 @@
${resp}= Get Request
... openbmc ${base_uri} headers=${headers} timeout=${timeout}
- Return From Keyword If ${response_format} != "json" ${resp}
+ Return From Keyword If ${resp_check} == ${0} ${resp}
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
@@ -104,7 +103,7 @@
# (e.g. 'SessionService/Sessions/XIApcw39QU').
# xauth_token Authentication token.
# timeout Timeout in seconds to establish connection with URI.
- # resp_check By default check the response status
+ # resp_check By default check the response status.
${base_uri} = Catenate SEPARATOR= ${REDFISH_BASE_URI} ${uri_suffix}
diff --git a/redfish_test/test_redfish_interfaces.robot b/redfish_test/test_redfish_interfaces.robot
index e2dd6fd..f1088ab 100644
--- a/redfish_test/test_redfish_interfaces.robot
+++ b/redfish_test/test_redfish_interfaces.robot
@@ -44,6 +44,15 @@
Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
+Test Delete Redfish Response Codes
+ [Documentation] Get Redfish response codes and validate them.
+ [Tags] Test_Delete_Redfish_Response_Codes
+
+ ${resp} = Redfish Delete Request
+ ... Systems/motherboard xauth_token=${test_auth_token} resp_check=${0}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
+
+
Test Invalid Redfish Token Access
[Documentation] Access valid session id using invalid session token.
[Tags] Test_Invalid_Redfish_Token_Access
@@ -51,7 +60,7 @@
${session_url} =
... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
${resp} = Redfish Get Request
- ... ${session_url} xauth_token=InvalidToken response_format=${0}
+ ... ${session_url} xauth_token=InvalidToken resp_check=${0}
Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
@@ -61,6 +70,7 @@
[Template] Execute Get And Check Response
# Expected status URL Path
+ ${HTTP_OK} ${EMPTY}
${HTTP_OK} Systems
${HTTP_OK} Systems/motherboard
${HTTP_OK} Chassis/system
@@ -77,7 +87,7 @@
# url_path URL path.
${resp} = Redfish Get Request
- ... ${url_path} xauth_token=${test_auth_token} response_format=${0}
+ ... ${url_path} xauth_token=${test_auth_token} resp_check=${0}
Should Be Equal As Strings ${resp.status_code} ${expected_response_code}