diff options
author | Mark Adams <mark@markadams.me> | 2015-01-25 06:49:56 -0600 |
---|---|---|
committer | Mark Adams <mark@markadams.me> | 2015-01-25 06:49:56 -0600 |
commit | 1b21187bd79251583829e62c64b6936947c0f8bf (patch) | |
tree | 85a58de14613b575eaf321843816a16c56abfc1d | |
parent | 0f9f0da52494db42315b84205d8d9181e66068a7 (diff) | |
download | pyjwt-1b21187bd79251583829e62c64b6936947c0f8bf.tar.gz |
Added tests for `pyjwt.compat.constant_time_compare`
-rw-r--r-- | tests/test_compat.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_compat.py b/tests/test_compat.py index e69de29..34f91db 100644 --- a/tests/test_compat.py +++ b/tests/test_compat.py @@ -0,0 +1,16 @@ +from .compat import unittest + +from jwt.compat import constant_time_compare + +class TestCompat(unittest.TestCase): + def setUp(self): # noqa + pass + + def test_constant_time_compare_returns_true_if_same(self): + self.assertTrue(constant_time_compare('abc', 'abc')) + + def test_constant_time_compare_returns_false_if_diff_lengths(self): + self.assertFalse(constant_time_compare('abc', 'abcd')) + + def test_constant_time_compare_returns_false_if_totally_different(self): + self.assertFalse(constant_time_compare('abcd', 'efgh')) |