From a62d3afae43ebe191fe86f8d1ebed3e8bfaeba17 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Wed, 27 Mar 2013 12:10:08 -0400 Subject: Fix token ids for memcached Bug 1119641 Change-Id: Ia22764acc69a272b37364193d10c553a48679b9a --- tests/test_backend.py | 10 ++++++++-- tests/test_backend_memcache.py | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_backend.py b/tests/test_backend.py index 6768e9c5..a7344067 100644 --- a/tests/test_backend.py +++ b/tests/test_backend.py @@ -1949,8 +1949,14 @@ class IdentityTests(object): class TokenTests(object): + def _create_token_id(self): + token_id = "" + for i in range(1, 20): + token_id += uuid.uuid4().hex + return token_id + def test_token_crud(self): - token_id = uuid.uuid4().hex + token_id = self._create_token_id() data = {'id': token_id, 'a': 'b', 'trust_id': None, 'user': {'id': 'testuserid'}} @@ -1974,7 +1980,7 @@ class TokenTests(object): self.token_api.delete_token, token_id) def create_token_sample_data(self, tenant_id=None, trust_id=None): - token_id = uuid.uuid4().hex + token_id = self._create_token_id() data = {'id': token_id, 'a': 'b', 'user': {'id': 'testuserid'}} if tenant_id is not None: diff --git a/tests/test_backend_memcache.py b/tests/test_backend_memcache.py index b7f26b1d..9fbaeb90 100644 --- a/tests/test_backend_memcache.py +++ b/tests/test_backend_memcache.py @@ -79,14 +79,14 @@ class MemcacheToken(test.TestCase, test_backend.TokenTests): self.token_api = token_memcache.Token(client=fake_client) def test_create_unicode_token_id(self): - token_id = unicode(uuid.uuid4().hex) + token_id = unicode(self._create_token_id()) data = {'id': token_id, 'a': 'b', 'user': {'id': 'testuserid'}} self.token_api.create_token(token_id, data) self.token_api.get_token(token_id) def test_create_unicode_user_id(self): - token_id = uuid.uuid4().hex + token_id = self._create_token_id() user_id = unicode(uuid.uuid4().hex) data = {'id': token_id, 'a': 'b', 'user': {'id': user_id}} -- cgit