Test invalid token access
Changes:
- Added test case to access valid session id with invalid
auth token
- Added example and verification from response data.
Resolves openbmc/openbmc-test-automation#1431
Change-Id: Ice8aa5fecc8ac527c1a9d29cda944ff9ed17277f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish_test/test_redfish_interfaces.robot b/redfish_test/test_redfish_interfaces.robot
index b8ea79f..8208d1a 100644
--- a/redfish_test/test_redfish_interfaces.robot
+++ b/redfish_test/test_redfish_interfaces.robot
@@ -13,11 +13,35 @@
[Documentation] Establish session to BMC and get session identifier.
[Tags] Test_Get_Redfish_Session_Id
+ # Example:
+ # {
+ # "@odata.context": "/redfish/v1/$metadata#Session.Session",
+ # "@odata.id": "/redfish/v1/SessionService/Sessions/gxgwFkuPqo",
+ # "@odata.type": "#Session.v1_0_2.Session",
+ # "Description": "Manager User Session",
+ # "Id": "gxgwFkuPqo",
+ # "Name": "User Session",
+ # "UserName": "root"
+ # }
+
${session_url} =
... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
${resp} = Redfish Get Request
- ... ${session_url} xauth_token=${test_auth_token} response_format=${0}
- Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ ... ${session_url} xauth_token=${test_auth_token}
+
+ Should Be Equal As Strings
+ ... /redfish/v1/${session_url} ${resp["@odata.id"]}
+
+
+Test Invalid Redfish Token Access
+ [Documentation] Access valid session id using invalid session token.
+ [Tags] Test_Invalid_Redfish_Token_Access
+
+ ${session_url} =
+ ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
+ ${resp} = Redfish Get Request
+ ... ${session_url} xauth_token=InvalidToken response_format=${0}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
Test Get Redfish Response Codes