(self)
| 2876 | self.assertEqual(response.code, 403) |
| 2877 | |
| 2878 | def test_refresh_token(self): |
| 2879 | token = self.xsrf_token |
| 2880 | tokens_seen = set([token]) |
| 2881 | # A user's token is stable over time. Refreshing the page in one tab |
| 2882 | # might update the cookie while an older tab still has the old cookie |
| 2883 | # in its DOM. Simulate this scenario by passing a constant token |
| 2884 | # in the body and re-querying for the token. |
| 2885 | for i in range(5): |
| 2886 | token = self.get_token(token) |
| 2887 | # Tokens are encoded uniquely each time |
| 2888 | tokens_seen.add(token) |
| 2889 | response = self.fetch( |
| 2890 | "/", |
| 2891 | method="POST", |
| 2892 | body=urllib.parse.urlencode(dict(_xsrf=self.xsrf_token)), |
| 2893 | headers=self.cookie_headers(token), |
| 2894 | ) |
| 2895 | self.assertEqual(response.code, 200) |
| 2896 | self.assertEqual(len(tokens_seen), 6) |
| 2897 | |
| 2898 | def test_versioning(self): |
| 2899 | # Version 1 still produces distinct tokens per request. |
nothing calls this directly
no test coverage detected