summaryrefslogtreecommitdiff
path: root/tests/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/utils.py b/tests/utils.py
index c4530e8..04c5890 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -12,8 +12,10 @@ class TestCase(unittest.TestCase):
TEST_TENANT_NAME = 'aTenant'
TEST_TOKEN = 'aToken'
TEST_USER = 'test'
- TEST_URL = 'http://127.0.0.1:5000/v2.0'
- TEST_ADMIN_URL = 'http://127.0.0.1:35357/v2.0'
+ TEST_ROOT_URL = 'http://127.0.0.1:5000/'
+ TEST_URL = '%s%s' % (TEST_ROOT_URL, 'v2.0')
+ TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
+ TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
TEST_SERVICE_CATALOG = [{
"endpoints": [{
@@ -79,3 +81,24 @@ class TestCase(unittest.TestCase):
super(TestCase, self).tearDown()
self.mox.UnsetStubs()
self.mox.VerifyAll()
+
+
+class UnauthenticatedTestCase(unittest.TestCase):
+ """ Class used as base for unauthenticated calls """
+ TEST_ROOT_URL = 'http://127.0.0.1:5000/'
+ TEST_URL = '%s%s' % (TEST_ROOT_URL, 'v2.0')
+ TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
+ TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
+
+ def setUp(self):
+ super(UnauthenticatedTestCase, self).setUp()
+ self.mox = mox.Mox()
+ self._original_time = time.time
+ time.time = lambda: 1234
+ httplib2.Http.request = self.mox.CreateMockAnything()
+
+ def tearDown(self):
+ time.time = self._original_time
+ super(UnauthenticatedTestCase, self).tearDown()
+ self.mox.UnsetStubs()
+ self.mox.VerifyAll()