1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #24652 -- Used SimpleTestCase where appropriate.

This commit is contained in:
Simon Charette
2015-04-17 17:38:20 -04:00
parent e2b77acedd
commit be67400b47
93 changed files with 362 additions and 340 deletions

View File

@@ -1,10 +1,10 @@
from django.conf import settings
from django.core.checks.security import base, csrf, sessions
from django.test import TestCase
from django.test import SimpleTestCase
from django.test.utils import override_settings
class CheckSessionCookieSecureTest(TestCase):
class CheckSessionCookieSecureTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.sessions import check_session_cookie_secure
@@ -55,7 +55,7 @@ class CheckSessionCookieSecureTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckSessionCookieHttpOnlyTest(TestCase):
class CheckSessionCookieHttpOnlyTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.sessions import check_session_cookie_httponly
@@ -106,7 +106,7 @@ class CheckSessionCookieHttpOnlyTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckCSRFMiddlewareTest(TestCase):
class CheckCSRFMiddlewareTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.csrf import check_csrf_middleware
@@ -125,7 +125,7 @@ class CheckCSRFMiddlewareTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckCSRFCookieSecureTest(TestCase):
class CheckCSRFCookieSecureTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.csrf import check_csrf_cookie_secure
@@ -156,7 +156,7 @@ class CheckCSRFCookieSecureTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckCSRFCookieHttpOnlyTest(TestCase):
class CheckCSRFCookieHttpOnlyTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.csrf import check_csrf_cookie_httponly
@@ -187,7 +187,7 @@ class CheckCSRFCookieHttpOnlyTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckSecurityMiddlewareTest(TestCase):
class CheckSecurityMiddlewareTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_security_middleware
@@ -206,7 +206,7 @@ class CheckSecurityMiddlewareTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckStrictTransportSecurityTest(TestCase):
class CheckStrictTransportSecurityTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_sts
@@ -238,7 +238,7 @@ class CheckStrictTransportSecurityTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckStrictTransportSecuritySubdomainsTest(TestCase):
class CheckStrictTransportSecuritySubdomainsTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_sts_include_subdomains
@@ -282,7 +282,7 @@ class CheckStrictTransportSecuritySubdomainsTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckXFrameOptionsMiddlewareTest(TestCase):
class CheckXFrameOptionsMiddlewareTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_xframe_options_middleware
@@ -300,7 +300,7 @@ class CheckXFrameOptionsMiddlewareTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckXFrameOptionsDenyTest(TestCase):
class CheckXFrameOptionsDenyTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_xframe_deny
@@ -333,7 +333,7 @@ class CheckXFrameOptionsDenyTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckContentTypeNosniffTest(TestCase):
class CheckContentTypeNosniffTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_content_type_nosniff
@@ -365,7 +365,7 @@ class CheckContentTypeNosniffTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckXssFilterTest(TestCase):
class CheckXssFilterTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_xss_filter
@@ -397,7 +397,7 @@ class CheckXssFilterTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckSSLRedirectTest(TestCase):
class CheckSSLRedirectTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_ssl_redirect
@@ -429,7 +429,7 @@ class CheckSSLRedirectTest(TestCase):
self.assertEqual(self.func(None), [])
class CheckSecretKeyTest(TestCase):
class CheckSecretKeyTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_secret_key
@@ -466,7 +466,7 @@ class CheckSecretKeyTest(TestCase):
self.assertEqual(self.func(None), [base.W009])
class CheckDebugTest(TestCase):
class CheckDebugTest(SimpleTestCase):
@property
def func(self):
from django.core.checks.security.base import check_debug

View File

@@ -10,7 +10,7 @@ from django.core.checks.registry import CheckRegistry
from django.core.management import call_command
from django.core.management.base import CommandError
from django.db import models
from django.test import TestCase
from django.test import SimpleTestCase
from django.test.utils import override_settings, override_system_checks
from django.utils.encoding import force_text
from django.utils.six import StringIO
@@ -23,7 +23,7 @@ class DummyObj(object):
return "obj"
class SystemCheckFrameworkTests(TestCase):
class SystemCheckFrameworkTests(SimpleTestCase):
def test_register_and_run_checks(self):
@@ -69,7 +69,7 @@ class SystemCheckFrameworkTests(TestCase):
self.assertEqual(sorted(errors), [4, 5])
class MessageTests(TestCase):
class MessageTests(SimpleTestCase):
def test_printing(self):
e = Error("Message", hint="Hint", obj=DummyObj())
@@ -126,7 +126,7 @@ def deployment_system_check(**kwargs):
deployment_system_check.tags = ['deploymenttag']
class CheckCommandTests(TestCase):
class CheckCommandTests(SimpleTestCase):
def setUp(self):
simple_system_check.kwargs = None
@@ -213,7 +213,7 @@ def custom_warning_system_check(app_configs, **kwargs):
]
class SilencingCheckTests(TestCase):
class SilencingCheckTests(SimpleTestCase):
def setUp(self):
self.old_stdout, self.old_stderr = sys.stdout, sys.stderr
@@ -266,7 +266,7 @@ class IsolateModelsMixin(object):
apps.clear_cache()
class CheckFrameworkReservedNamesTests(IsolateModelsMixin, TestCase):
class CheckFrameworkReservedNamesTests(IsolateModelsMixin, SimpleTestCase):
@override_settings(
SILENCED_SYSTEM_CHECKS=['models.E20', 'fields.W342'], # ForeignKey(unique=True)
INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes', 'check_framework']