MCPcopy Create free account
hub / github.com/EasyIME/PIME / test_refresh_token

Method test_refresh_token

python/python3/tornado/test/web_test.py:2878–2896  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 4

get_tokenMethod · 0.95
cookie_headersMethod · 0.95
addMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected