Test multiple valid URL without login
Changes:
- GET base default removed
- Update test to use template.
- Check following '/', /redfish, `/redfish/v1 URL without
logged in.
This enable to test request for valid and invalid resource URL.
Change-Id: Ieaf0a6c6d9982078d39c4607d0e41cf2843ab4a9
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/bmc_redfish.py b/lib/bmc_redfish.py
index ae31d40..178a207 100644
--- a/lib/bmc_redfish.py
+++ b/lib/bmc_redfish.py
@@ -68,12 +68,11 @@
Perform a GET request and return response.
Description of argument(s):
- resource_path URI resource relative path (e.g. "Systems/1").
+ resource_path URI resource absolute path (e.g. "/redfish/v1/Systems/1").
args/kwargs These are passed directly to the corresponding
RestClientBase method.
"""
- self._rest_response_ = self._robj_.get('/redfish/v1/' + resource_path,
- *args, **kwargs)
+ self._rest_response_ = self._robj_.get(resource_path, *args, **kwargs)
return self._rest_response_
def post(self, resource_path, *args, **kwargs):
diff --git a/redfish/service_root/test_service_root.robot b/redfish/service_root/test_service_root.robot
index 8dfd17a..6f1bfa3 100644
--- a/redfish/service_root/test_service_root.robot
+++ b/redfish/service_root/test_service_root.robot
@@ -2,9 +2,6 @@
Resource ../../lib/resource.txt
Resource ../../lib/bmc_redfish_resource.robot
-Suite Teardown redfish.Logout
-
-
*** Test Cases ***
Login And Logout BMCweb
@@ -16,12 +13,14 @@
GET BMCweb Hypermedia Without Login
- [Documentation] GET /redfish/v1 without login.
+ [Documentation] GET hypermedia URL without login.
[Tags] GET_BMCweb_Hypermedia_Without_Login
+ [Template] GET And Verify Redfish Response
- redfish.Logout
- ${resp}= redfish.Get ${EMPTY}
- Should Be Equal As Strings ${resp.status} ${HTTP_OK}
+ # Expect status Resource URL Path
+ ${HTTP_OK} /
+ ${HTTP_OK} /redfish
+ ${HTTP_OK} /redfish/v1
GET SessionService Resource With Login
@@ -29,7 +28,7 @@
[Tags] GET_SessionService_Resource_With_Login
redfish.Login
- ${resp}= redfish.Get SessionService
+ ${resp}= redfish.Get /redfish/v1/SessionService
Should Be Equal As Strings ${resp.status} ${HTTP_OK}
@@ -38,7 +37,7 @@
[Tags] GET_SessionService_Without_Login
redfish.Logout
- ${resp}= redfish.Get SessionService
+ ${resp}= redfish.Get /redfish/v1/SessionService
Should Be Equal As Strings ${resp.status} ${HTTP_UNAUTHORIZED}
@@ -69,10 +68,24 @@
# Example o/p:
# [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
# {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
- ${resp_list}= redfish.Get SessionService/Sessions
+ ${resp_list}= redfish.Get /redfish/v1/SessionService/Sessions
redfish.Delete ${resp_list.dict["Members"][0]["@odata.id"]}
- ${resp}= redfish.Get SessionService/Sessions
+ ${resp}= redfish.Get /redfish/v1/SessionService/Sessions
Should Not Contain ${resp.dict["Members"]} ${resp_list.dict["Members"][0]["@odata.id"]}
+ redfish.Logout
+
+*** Keywords ***
+
+GET And Verify Redfish Response
+ [Documentation] GET given resource and verfiy response.
+ [Arguments] ${expected_response_code} ${resource_path}
+
+ # Description of arguments:
+ # expected_response_code Expected REST status codes.
+ # resource_path Redfish resource URL path.
+
+ ${resp}= redfish.Get ${resource_path}
+ Should Be Equal As Strings ${resp.status} ${expected_response_code}