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
This commit is contained in:
parent
c0b7e4984a
commit
ac2a503d4d
@ -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': {
|
||||
|
Loading…
Reference in New Issue
Block a user