mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
Replaced single quotes with double quotes.
This commit is contained in:
parent
abc9ea61ef
commit
1abbd58bef
@ -831,8 +831,8 @@ class CsrfViewMiddlewareTestMixin(CsrfFunctionTestMixin):
|
|||||||
def _test_https_good_referer_matches_cookie_domain(self):
|
def _test_https_good_referer_matches_cookie_domain(self):
|
||||||
req = self._get_POST_request_with_token()
|
req = self._get_POST_request_with_token()
|
||||||
req._is_secure_override = True
|
req._is_secure_override = True
|
||||||
req.META['HTTP_HOST'] = 'www.example.com'
|
req.META["HTTP_HOST"] = "www.example.com"
|
||||||
req.META['HTTP_REFERER'] = 'https://foo.example.com/'
|
req.META["HTTP_REFERER"] = "https://foo.example.com/"
|
||||||
mw = CsrfViewMiddleware(post_form_view)
|
mw = CsrfViewMiddleware(post_form_view)
|
||||||
mw.process_request(req)
|
mw.process_request(req)
|
||||||
response = mw.process_view(req, post_form_view, (), {})
|
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):
|
def _test_https_good_referer_matches_cookie_domain_with_different_port(self):
|
||||||
req = self._get_POST_request_with_token()
|
req = self._get_POST_request_with_token()
|
||||||
req._is_secure_override = True
|
req._is_secure_override = True
|
||||||
req.META['HTTP_HOST'] = 'www.example.com:4443'
|
req.META["HTTP_HOST"] = "www.example.com:4443"
|
||||||
req.META['HTTP_REFERER'] = 'https://foo.example.com:4443/'
|
req.META["HTTP_REFERER"] = "https://foo.example.com:4443/"
|
||||||
mw = CsrfViewMiddleware(post_form_view)
|
mw = CsrfViewMiddleware(post_form_view)
|
||||||
mw.process_request(req)
|
mw.process_request(req)
|
||||||
response = mw.process_view(req, post_form_view, (), {})
|
response = mw.process_view(req, post_form_view, (), {})
|
||||||
@ -1275,10 +1275,10 @@ class CsrfViewMiddlewareTests(CsrfViewMiddlewareTestMixin, SimpleTestCase):
|
|||||||
self._check_token_present(resp, csrf_cookie)
|
self._check_token_present(resp, csrf_cookie)
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
ALLOWED_HOSTS=['www.example.com'],
|
ALLOWED_HOSTS=["www.example.com"],
|
||||||
CSRF_COOKIE_DOMAIN='.example.com',
|
CSRF_COOKIE_DOMAIN=".example.com",
|
||||||
USE_X_FORWARDED_PORT=True,
|
USE_X_FORWARDED_PORT=True,
|
||||||
USE_X_FORWARDED_HOST=True
|
USE_X_FORWARDED_HOST=True,
|
||||||
)
|
)
|
||||||
def test_https_good_referer_behind_proxy(self):
|
def test_https_good_referer_behind_proxy(self):
|
||||||
"""
|
"""
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -111,37 +111,37 @@ class SitesFrameworkTests(TestCase):
|
|||||||
|
|
||||||
# Host header without port
|
# Host header without port
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
request.META = {'HTTP_HOST': 'example.com'}
|
request.META = {"HTTP_HOST": "example.com"}
|
||||||
site = get_current_site(request)
|
site = get_current_site(request)
|
||||||
self.assertEqual(site, s1)
|
self.assertEqual(site, s1)
|
||||||
|
|
||||||
# Host header with port - match, no fallback without port
|
# Host header with port - match, no fallback without port
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
request.META = {'HTTP_HOST': 'example.com:80'}
|
request.META = {"HTTP_HOST": "example.com:80"}
|
||||||
site = get_current_site(request)
|
site = get_current_site(request)
|
||||||
self.assertEqual(site, s2)
|
self.assertEqual(site, s2)
|
||||||
|
|
||||||
# Host header with port - no match, fallback without port
|
# Host header with port - no match, fallback without port
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
request.META = {'HTTP_HOST': 'example.com:81'}
|
request.META = {"HTTP_HOST": "example.com:81"}
|
||||||
site = get_current_site(request)
|
site = get_current_site(request)
|
||||||
self.assertEqual(site, s1)
|
self.assertEqual(site, s1)
|
||||||
|
|
||||||
# Host header with non-matching domain
|
# Host header with non-matching domain
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
request.META = {'HTTP_HOST': 'example.net'}
|
request.META = {"HTTP_HOST": "example.net"}
|
||||||
with self.assertRaises(ObjectDoesNotExist):
|
with self.assertRaises(ObjectDoesNotExist):
|
||||||
get_current_site(request)
|
get_current_site(request)
|
||||||
|
|
||||||
# Ensure domain for RequestSite always matches host header
|
# 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 = HttpRequest()
|
||||||
request.META = {'HTTP_HOST': 'example.com'}
|
request.META = {"HTTP_HOST": "example.com"}
|
||||||
site = get_current_site(request)
|
site = get_current_site(request)
|
||||||
self.assertEqual(site.name, "example.com")
|
self.assertEqual(site.name, "example.com")
|
||||||
|
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
request.META = {'HTTP_HOST': 'example.com:80'}
|
request.META = {"HTTP_HOST": "example.com:80"}
|
||||||
site = get_current_site(request)
|
site = get_current_site(request)
|
||||||
self.assertEqual(site.name, "example.com:80")
|
self.assertEqual(site.name, "example.com:80")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user