Esempio n. 1
0
    def test_generate_user_token_multi(self):
        """Collision test for user tokens."""

        # Note: you do not want to make n too big since this is a O(n^2)
        # complexity test.
        n = 10
        tokens = [generate_user_token(self.user) for _ in range(n)]

        for i in range(n):
            for j in range(i + 1, n):
                self.assertNotEqual(tokens[i], tokens[j])
Esempio n. 2
0
 def test_generate_user_token_single(self):
     """Single test for generating an user token."""
     token = generate_user_token(self.user)
     self.assertEqual(len(token), 40)