1
0
mirror of https://github.com/django/django.git synced 2025-04-03 13:06:49 +00:00

Replaced single quotes with double quotes.

This commit is contained in:
GappleBee 2024-11-21 19:23:20 +00:00
parent abc9ea61ef
commit 1abbd58bef
3 changed files with 668 additions and 538 deletions

View File

@ -831,8 +831,8 @@ class CsrfViewMiddlewareTestMixin(CsrfFunctionTestMixin):
def _test_https_good_referer_matches_cookie_domain(self):
req = self._get_POST_request_with_token()
req._is_secure_override = True
req.META['HTTP_HOST'] = 'www.example.com'
req.META['HTTP_REFERER'] = 'https://foo.example.com/'
req.META["HTTP_HOST"] = "www.example.com"
req.META["HTTP_REFERER"] = "https://foo.example.com/"
mw = CsrfViewMiddleware(post_form_view)
mw.process_request(req)
response = mw.process_view(req, post_form_view, (), {})
@ -841,8 +841,8 @@ class CsrfViewMiddlewareTestMixin(CsrfFunctionTestMixin):
def _test_https_good_referer_matches_cookie_domain_with_different_port(self):
req = self._get_POST_request_with_token()
req._is_secure_override = True
req.META['HTTP_HOST'] = 'www.example.com:4443'
req.META['HTTP_REFERER'] = 'https://foo.example.com:4443/'
req.META["HTTP_HOST"] = "www.example.com:4443"
req.META["HTTP_REFERER"] = "https://foo.example.com:4443/"
mw = CsrfViewMiddleware(post_form_view)
mw.process_request(req)
response = mw.process_view(req, post_form_view, (), {})
@ -1275,10 +1275,10 @@ class CsrfViewMiddlewareTests(CsrfViewMiddlewareTestMixin, SimpleTestCase):
self._check_token_present(resp, csrf_cookie)
@override_settings(
ALLOWED_HOSTS=['www.example.com'],
CSRF_COOKIE_DOMAIN='.example.com',
ALLOWED_HOSTS=["www.example.com"],
CSRF_COOKIE_DOMAIN=".example.com",
USE_X_FORWARDED_PORT=True,
USE_X_FORWARDED_HOST=True
USE_X_FORWARDED_HOST=True,
)
def test_https_good_referer_behind_proxy(self):
"""

File diff suppressed because it is too large Load Diff

View File

@ -111,37 +111,37 @@ class SitesFrameworkTests(TestCase):
# Host header without port
request = HttpRequest()
request.META = {'HTTP_HOST': 'example.com'}
request.META = {"HTTP_HOST": "example.com"}
site = get_current_site(request)
self.assertEqual(site, s1)
# Host header with port - match, no fallback without port
request = HttpRequest()
request.META = {'HTTP_HOST': 'example.com:80'}
request.META = {"HTTP_HOST": "example.com:80"}
site = get_current_site(request)
self.assertEqual(site, s2)
# Host header with port - no match, fallback without port
request = HttpRequest()
request.META = {'HTTP_HOST': 'example.com:81'}
request.META = {"HTTP_HOST": "example.com:81"}
site = get_current_site(request)
self.assertEqual(site, s1)
# Host header with non-matching domain
request = HttpRequest()
request.META = {'HTTP_HOST': 'example.net'}
request.META = {"HTTP_HOST": "example.net"}
with self.assertRaises(ObjectDoesNotExist):
get_current_site(request)
# Ensure domain for RequestSite always matches host header
with self.modify_settings(INSTALLED_APPS={'remove': 'django.contrib.sites'}):
with self.modify_settings(INSTALLED_APPS={"remove": "django.contrib.sites"}):
request = HttpRequest()
request.META = {'HTTP_HOST': 'example.com'}
request.META = {"HTTP_HOST": "example.com"}
site = get_current_site(request)
self.assertEqual(site.name, "example.com")
request = HttpRequest()
request.META = {'HTTP_HOST': 'example.com:80'}
request.META = {"HTTP_HOST": "example.com:80"}
site = get_current_site(request)
self.assertEqual(site.name, "example.com:80")