コード例 #1
0
 def test_parse_token_accepts_v1(self):
     with override_settings(SESAME_TOKENS=["sesame.tokens_v1"]):
         token = create_token(self.user)
     user = parse_token(token, self.get_user)
     self.assertEqual(user, self.user)
     self.assertLogsContain("Valid token for user john")
コード例 #2
0
 def test_parse_token_force_v1(self):
     with override_settings(SESAME_TOKENS=["sesame.tokens_v2"]):
         token = create_token(self.user)
     user = parse_token(token, self.get_user)
     self.assertEqual(user, None)
     self.assertLogsContain("Bad token: doesn't match a supported format")
コード例 #3
0
 def test_parse_token_accepts_v2(self):
     token = create_token(self.user)
     user = parse_token(token, self.get_user)
     self.assertEqual(user, self.user)
     self.assertLogsContain("Valid token for user john")