summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2015-11-12 22:15:51 -0700
committerBert JW Regeer <bertjw@regeer.org>2015-11-12 22:15:51 -0700
commit203cf3accd0bec0cc08eab8e736f26cd0e711d8b (patch)
tree2cf21a4a090c5fce4943f9d8d65eebbad4b88bae
parentb084d76c8941609caca5b8fcd451ce516c1b3611 (diff)
downloadpyramid-203cf3accd0bec0cc08eab8e736f26cd0e711d8b.tar.gz
pyramid-203cf3accd0bec0cc08eab8e736f26cd0e711d8b.tar.bz2
pyramid-203cf3accd0bec0cc08eab8e736f26cd0e711d8b.zip
Add AuthTkt test to test ticket timeouts
Previous tests did not actually test the code, other than by chance, which meant future changes could regress, which is bad.
-rw-r--r--pyramid/tests/test_authentication.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pyramid/tests/test_authentication.py b/pyramid/tests/test_authentication.py
index 4a6525af2..0a22e5965 100644
--- a/pyramid/tests/test_authentication.py
+++ b/pyramid/tests/test_authentication.py
@@ -769,6 +769,17 @@ class TestAuthTktCookieHelper(unittest.TestCase):
helper = self._makeOne('secret', timeout='1')
self.assertEqual(helper.timeout, 1)
+ def test_identify_cookie_timeout_aged(self):
+ import time
+ helper = self._makeOne('secret', timeout=10)
+ now = time.time()
+ helper.auth_tkt.timestamp = now - 1
+ helper.now = now + 10
+ helper.auth_tkt.tokens = (text_('a'), )
+ request = self._makeRequest('bogus')
+ result = helper.identify(request)
+ self.assertFalse(result)
+
def test_identify_cookie_reissue(self):
import time
helper = self._makeOne('secret', timeout=10, reissue_time=0)