Fixes bug/902405. Adds users tests and methods to admin client
Change-Id: Ifa9d5001c9961f747b91ff7cec9b7ad2fc5a4aaa
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index fd2f684..a18e563 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -18,7 +18,6 @@
import json
import httplib2
import logging
-import sys
import time
from tempest import exceptions
@@ -74,6 +73,15 @@
self.token = None
self.base_url = None
+ def get_auth(self):
+ """Returns the token of the current request or sets the token if
+ none"""
+
+ if not self.token:
+ self._set_auth()
+
+ return self.token
+
def basic_auth(self, user, password, auth_url):
"""
Provides authentication for the target API
@@ -177,7 +185,7 @@
req_url = "%s/%s" % (self.base_url, url)
resp, resp_body = self.http_obj.request(req_url, method,
headers=headers, body=body)
- if resp.status == 401:
+ if resp.status == 401 or resp.status == 403:
self._log(req_url, body, resp, resp_body)
raise exceptions.Unauthorized()