diff options
author | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2016-09-26 15:10:42 +0800 |
---|---|---|
committer | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2016-09-26 15:10:42 +0800 |
commit | 6ced68d629f62eb7ed67bd1f0e99dfa2ac613a57 (patch) | |
tree | bee791f736dba649b8f5b605d933aa1ed68583cf /keystonemiddleware/tests/unit/auth_token | |
parent | 3e95edf0e43af9227d101c99c0baee2d38c96435 (diff) | |
download | keystonemiddleware-6ced68d629f62eb7ed67bd1f0e99dfa2ac613a57.tar.gz |
Use method constant_time_compare from oslo.utils
Oslo.utils provides same function constant_time_compare, so just
use it.
Change-Id: Ie9a9f1912b22b5bda55497542ef348b82e7b8939
Diffstat (limited to 'keystonemiddleware/tests/unit/auth_token')
-rw-r--r-- | keystonemiddleware/tests/unit/auth_token/test_memcache_crypt.py | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/keystonemiddleware/tests/unit/auth_token/test_memcache_crypt.py b/keystonemiddleware/tests/unit/auth_token/test_memcache_crypt.py index e918983..48a7fb3 100644 --- a/keystonemiddleware/tests/unit/auth_token/test_memcache_crypt.py +++ b/keystonemiddleware/tests/unit/auth_token/test_memcache_crypt.py @@ -20,27 +20,6 @@ class MemcacheCryptPositiveTests(utils.BaseTestCase): def _setup_keys(self, strategy): return memcache_crypt.derive_keys(b'token', b'secret', strategy) - def test_constant_time_compare(self): - # make sure it works as a compare, the "constant time" aspect - # isn't appropriate to test in unittests - ctc = memcache_crypt.constant_time_compare - self.assertTrue(ctc('abcd', 'abcd')) - self.assertTrue(ctc('', '')) - self.assertFalse(ctc('abcd', 'efgh')) - self.assertFalse(ctc('abc', 'abcd')) - self.assertFalse(ctc('abc', 'abc\x00')) - self.assertFalse(ctc('', 'abc')) - - # For Python 3, we want to test these functions with both str and bytes - # as input. - if six.PY3: - self.assertTrue(ctc(b'abcd', b'abcd')) - self.assertTrue(ctc(b'', b'')) - self.assertFalse(ctc(b'abcd', b'efgh')) - self.assertFalse(ctc(b'abc', b'abcd')) - self.assertFalse(ctc(b'abc', b'abc\x00')) - self.assertFalse(ctc(b'', b'abc')) - def test_derive_keys(self): keys = self._setup_keys(b'strategy') self.assertEqual(len(keys['ENCRYPTION']), |