From ac2a503d4d9ada69b5d5c1fbd2acf7397d8b4ac9 Mon Sep 17 00:00:00 2001 From: David Peraza Date: Wed, 16 Oct 2013 13:14:10 -0500 Subject: [PATCH] Changes FakeMemcache to set token to expire on utcnow + 5 mins fixes bug 1240994 keystoneclient 0.4 will use utcnow to compare expiration date. The FakMemcache class sets expiration to datetime.now which sets date for local timezone. If this timezone happens to be behind utc the test will fail with expiration error because we are comparing utc + 5 mins with utc - 1 or more hours. Change-Id: I551506a5aaf0aef77476b11786399a66225603bf --- tests/api/v2/test_acl_scenarios.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api/v2/test_acl_scenarios.py b/tests/api/v2/test_acl_scenarios.py index 144112b73..4a5a661f6 100644 --- a/tests/api/v2/test_acl_scenarios.py +++ b/tests/api/v2/test_acl_scenarios.py @@ -41,7 +41,7 @@ class FakeMemcache(object): @staticmethod def get(key): if key == "tokens/%s" % VALID_TOKEN: - dt = datetime.datetime.now() + datetime.timedelta(minutes=5) + dt = timeutils.utcnow() + datetime.timedelta(minutes=5) return json.dumps(({'access': { 'token': {'id': VALID_TOKEN}, 'user': { @@ -54,7 +54,7 @@ class FakeMemcache(object): ]}, }}, timeutils.isotime(dt))) if key == "tokens/%s" % VALID_TOKEN2: - dt = datetime.datetime.now() + datetime.timedelta(minutes=5) + dt = timeutils.utcnow() + datetime.timedelta(minutes=5) return json.dumps(({'access': { 'token': {'id': VALID_TOKEN2}, 'user': {