Test Delete Redfish Session With Invalid Token
Change-Id: I465c7b09063c5be1845b2f18bb603c6a3ce2a7ff
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/redfish_client.robot b/lib/redfish_client.robot
index eeb87cf..badb389 100644
--- a/lib/redfish_client.robot
+++ b/lib/redfish_client.robot
@@ -97,12 +97,14 @@
[Arguments] ${uri_suffix}
... ${xauth_token}
... ${timeout}=10
+ ... ${resp_check}=${1}
# Description of argument(s):
# uri_suffix The URI to establish connection with
# (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
${base_uri} = Catenate SEPARATOR= ${REDFISH_BASE_URI} ${uri_suffix}
@@ -113,6 +115,9 @@
# Delete server session.
${resp}= Delete Request openbmc
... ${base_uri} headers=${headers} timeout=${timeout}
+
+ Return From Keyword If ${resp_check} == ${0} ${resp}
+
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
# Delete client sessions.
diff --git a/redfish_test/test_redfish_interfaces.robot b/redfish_test/test_redfish_interfaces.robot
index 3812797..e2dd6fd 100644
--- a/redfish_test/test_redfish_interfaces.robot
+++ b/redfish_test/test_redfish_interfaces.robot
@@ -33,6 +33,17 @@
... /redfish/v1/${session_url} ${resp["@odata.id"]}
+Test Delete Redfish Session With Invalid Token
+ [Documentation] Delete valid session with invalid token.
+
+ ${session_uri} =
+ ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
+
+ ${resp} = Redfish Delete Request
+ ... ${session_uri} xauth_token=InvalidToken resp_check=${0}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
+
+
Test Invalid Redfish Token Access
[Documentation] Access valid session id using invalid session token.
[Tags] Test_Invalid_Redfish_Token_Access