summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authortermie <github@anarkystic.com>2013-04-04 14:51:08 -0700
committertermie <github@anarkystic.com>2013-04-05 14:38:42 -0700
commita40f7fe155f2246eaa03b616ea01437da7759587 (patch)
treeb04cd3f081b15130db4dccf4b637287ea782ac0e /tests
parent31c6cd80e45466912836daa9303a4e8c154698c4 (diff)
downloadkeystone-a40f7fe155f2246eaa03b616ea01437da7759587.tar.gz
keystone-a40f7fe155f2246eaa03b616ea01437da7759587.tar.xz
keystone-a40f7fe155f2246eaa03b616ea01437da7759587.zip
stop using time.sleep in tests
we use timeutils.utcnow so that we have an overridable clock just like in the big leagues, making tests literally sleep just slows us down Change-Id: I8522aef1fab39a3370448bce779ca69d8f5e07b5
Diffstat (limited to 'tests')
-rw-r--r--tests/test_auth.py9
-rw-r--r--tests/test_keystoneclient.py3
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index 8f957dc3..85cc2212 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -14,7 +14,6 @@
import copy
import datetime
-import time
import uuid
from keystone import auth
@@ -748,6 +747,8 @@ class AuthWithTrust(AuthTest):
class TokenExpirationTest(AuthTest):
def _maintain_token_expiration(self):
"""Token expiration should be maintained after re-auth & validation."""
+ timeutils.set_time_override()
+
r = self.controller.authenticate(
{},
auth={
@@ -759,14 +760,14 @@ class TokenExpirationTest(AuthTest):
unscoped_token_id = r['access']['token']['id']
original_expiration = r['access']['token']['expires']
- time.sleep(0.5)
+ timeutils.advance_time_seconds(1)
r = self.controller.validate_token(
dict(is_admin=True, query_string={}),
token_id=unscoped_token_id)
self.assertEqual(original_expiration, r['access']['token']['expires'])
- time.sleep(0.5)
+ timeutils.advance_time_seconds(1)
r = self.controller.authenticate(
{},
@@ -779,7 +780,7 @@ class TokenExpirationTest(AuthTest):
scoped_token_id = r['access']['token']['id']
self.assertEqual(original_expiration, r['access']['token']['expires'])
- time.sleep(0.5)
+ timeutils.advance_time_seconds(1)
r = self.controller.validate_token(
dict(is_admin=True, query_string={}),
diff --git a/tests/test_keystoneclient.py b/tests/test_keystoneclient.py
index dd7dc1d7..2940fcf1 100644
--- a/tests/test_keystoneclient.py
+++ b/tests/test_keystoneclient.py
@@ -397,10 +397,11 @@ class KeystoneClientTests(object):
self.user_foo)
def test_token_expiry_maintained(self):
+ timeutils.set_time_override()
foo_client = self.get_client(self.user_foo)
orig_token = foo_client.service_catalog.catalog['token']
- time.sleep(.5)
+ timeutils.advance_time_seconds(1)
reauthenticated_token = foo_client.tokens.authenticate(
token=foo_client.auth_token)