def test_default_header_name(self): # default value for settings.CSRF_HEADER_NAME setting = 'HTTP_X_CSRFTOKEN' result = convert_header_name(setting) self.assertEqual(result, 'x-csrftoken')
def test_custom_header_name(self): setting = 'HTTP_X_XSRF_TOKEN' result = convert_header_name(setting) self.assertEqual(result, 'x-xsrf-token')
def test_custom_header_without_http_prefix(self): setting = 'X_XSRF_TOKEN' result = convert_header_name(setting) self.assertEqual(result, 'x-xsrf-token')