Exemple #1
0
 def test_hmac_expire(self):
     """ hmac will expire after a time """
     access = IMutableAccessBackend(signing_key='abc', token_expiration=-10)
     user = '******'
     token = access.get_signup_token(user)
     self.assertIsNone(access.validate_signup_token(token))
Exemple #2
0
 def test_hmac_invalid(self):
     """ hmac will be invalid if mutated """
     access = IMutableAccessBackend(signing_key='abc')
     user = '******'
     token = access.get_signup_token(user)
     self.assertIsNone(access.validate_signup_token(token + 'a'))
Exemple #3
0
 def test_hmac_validate(self):
     """ hmac will validate """
     access = IMutableAccessBackend(signing_key='abc')
     user = '******'
     token = access.get_signup_token(user)
     self.assertEqual(user, access.validate_signup_token(token))