Logout active REST connection session
Add support to logout in test REST lib.
Refer: https://github.com/openbmc/docs/blob/master/rest-api.md
Resolves openbmc/openbmc-test-automation#476
Change-Id: I3c88fd58a43c7236ca841a7a77a45d66100d9694
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/rest_client.robot b/lib/rest_client.robot
index 53d9a84..1bb8cc8 100644
--- a/lib/rest_client.robot
+++ b/lib/rest_client.robot
@@ -121,6 +121,20 @@
Should Be Equal ${status} PASS msg=${resp}
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+Log Out OpenBMC
+ [Documentation] Log out REST connection with active session "openbmc".
+
+ ${headers}= Create Dictionary Content-Type=application/json
+ ${data}= Create dictionary data=@{EMPTY}
+
+ # If there is no active sesion it will throw the following exception
+ # "Non-existing index or alias 'openbmc'"
+ ${resp}= Post Request openbmc
+ ... /logout data=${data} headers=${headers}
+
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ ... msg=${resp}
+
Log Request
[Arguments] &{kwargs}
${msg}= Catenate SEPARATOR= URI: ${AUTH_URI} ${kwargs["base_uri"]}