Cleaned up docstrings in csrf_tests/tests.py.

This commit is contained in:
Joshua Kehn 2015-09-04 15:58:15 -04:00 committed by Tim Graham
parent ab26b65b2f
commit e687794f6b
1 changed files with 13 additions and 15 deletions

View File

@ -90,8 +90,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_process_view_token_too_long(self): def test_process_view_token_too_long(self):
""" """
Check that if the token is longer than expected, it is ignored and If the token is longer than expected, it is ignored and a new token is
a new token is created. created.
""" """
req = self._get_GET_no_csrf_cookie_request() req = self._get_GET_no_csrf_cookie_request()
req.COOKIES[settings.CSRF_COOKIE_NAME] = 'x' * 10000000 req.COOKIES[settings.CSRF_COOKIE_NAME] = 'x' * 10000000
@ -311,7 +311,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
@override_settings(ALLOWED_HOSTS=['www.example.com']) @override_settings(ALLOWED_HOSTS=['www.example.com'])
def test_https_malformed_referer(self): def test_https_malformed_referer(self):
""" """
Test that a POST HTTPS request with a bad referer is rejected A POST HTTPS request with a bad referer is rejected.
""" """
req = self._get_POST_request_with_token() req = self._get_POST_request_with_token()
req._is_secure_override = True req._is_secure_override = True
@ -329,7 +329,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
@override_settings(ALLOWED_HOSTS=['www.example.com']) @override_settings(ALLOWED_HOSTS=['www.example.com'])
def test_https_good_referer(self): def test_https_good_referer(self):
""" """
Test that a POST HTTPS request with a good referer is accepted A POST HTTPS request with a good referer is accepted.
""" """
req = self._get_POST_request_with_token() req = self._get_POST_request_with_token()
req._is_secure_override = True req._is_secure_override = True
@ -341,8 +341,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
@override_settings(ALLOWED_HOSTS=['www.example.com']) @override_settings(ALLOWED_HOSTS=['www.example.com'])
def test_https_good_referer_2(self): def test_https_good_referer_2(self):
""" """
Test that a POST HTTPS request with a good referer is accepted A POST HTTPS request with a good referer is accepted where the referer
where the referer contains no trailing slash contains no trailing slash.
""" """
# See ticket #15617 # See ticket #15617
req = self._get_POST_request_with_token() req = self._get_POST_request_with_token()
@ -367,8 +367,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_ensures_csrf_cookie_no_middleware(self): def test_ensures_csrf_cookie_no_middleware(self):
""" """
Tests that ensures_csrf_cookie decorator fulfils its promise The ensure_csrf_cookie() decorator works without middleware.
with no middleware
""" """
@ensure_csrf_cookie @ensure_csrf_cookie
def view(request): def view(request):
@ -382,8 +381,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_ensures_csrf_cookie_with_middleware(self): def test_ensures_csrf_cookie_with_middleware(self):
""" """
Tests that ensures_csrf_cookie decorator fulfils its promise The ensure_csrf_cookie() decorator works with the CsrfViewMiddleware
with the middleware enabled. enabled.
""" """
@ensure_csrf_cookie @ensure_csrf_cookie
def view(request): def view(request):
@ -399,7 +398,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_ensures_csrf_cookie_no_logging(self): def test_ensures_csrf_cookie_no_logging(self):
""" """
Tests that ensure_csrf_cookie doesn't log warnings. See #19436. ensure_csrf_cookie() doesn't log warnings (#19436).
""" """
@ensure_csrf_cookie @ensure_csrf_cookie
def view(request): def view(request):
@ -425,8 +424,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_csrf_cookie_age(self): def test_csrf_cookie_age(self):
""" """
Test to verify CSRF cookie age can be set using CSRF cookie age can be set using settings.CSRF_COOKIE_AGE.
settings.CSRF_COOKIE_AGE.
""" """
req = self._get_GET_no_csrf_cookie_request() req = self._get_GET_no_csrf_cookie_request()
@ -447,8 +445,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_csrf_cookie_age_none(self): def test_csrf_cookie_age_none(self):
""" """
Test to verify CSRF cookie age does not have max age set and therefore CSRF cookie age does not have max age set and therefore uses
uses session-based cookies. session-based cookies.
""" """
req = self._get_GET_no_csrf_cookie_request() req = self._get_GET_no_csrf_cookie_request()