Check HTTP status code on Keystone Auth request 45/3545/1
authorGary Wu <gary.i.wu@huawei.com>
Wed, 19 Apr 2017 16:52:19 +0000 (09:52 -0700)
committerGary Wu <gary.i.wu@huawei.com>
Wed, 19 Apr 2017 16:55:51 +0000 (09:55 -0700)
The HTTP status code was not being checked during
Keystone Auth request, which causes failures to
only be detected down the road when the returned
JSON object is being parsed.  This change adds the
HTTP status code check right at point of API invocation.

Change-Id: Id53582090bb1e6c3ee04b3ec5488a8b6368dedfa
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
robot/resources/openstack/keystone_interface.robot

index 63f7245..6bf1d1e 100644 (file)
@@ -29,6 +29,7 @@ Run Openstack Auth Request
     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
     Log    Sending authenticate post request ${data_path} with headers ${headers} and data ${data}
     ${resp}=   Post Request    keystone        ${data_path}     data=${data}    headers=${headers}
+    Should Be True    200 <= ${resp.status_code} < 300
     Save Openstack Auth    ${alias}    ${resp.text}
     Log    Received response from keystone ${resp.text}