MCPcopy
hub / github.com/django/django / _check_token_present

Method _check_token_present

tests/csrf_tests/tests.py:324–334  ·  view source on GitHub ↗
(self, response, csrf_secret=None)

Source from the content-addressed store, hash-verified

322
323 # This method depends on _unmask_cipher_token() being correct.
324 def _check_token_present(self, response, csrf_secret=None):
325 if csrf_secret is None:
326 csrf_secret = TEST_SECRET
327 text = str(response.content, response.charset)
328 match = re.search('name="csrfmiddlewaretoken" value="(.*?)"', text)
329 self.assertTrue(
330 match,
331 f"Could not find a csrfmiddlewaretoken value in: {text}",
332 )
333 csrf_token = match[1]
334 self.assertMaskedSecretCorrect(csrf_token, csrf_secret)
335
336 def test_process_response_get_token_not_used(self):
337 """

Calls 2

searchMethod · 0.80

Tested by

no test coverage detected