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

@@ -14,7 +14,9 @@ from django.core.urlresolvers import NoReverseMatch, reverse
from django.http import HttpResponse
from django.template import Context, TemplateSyntaxError, engines
from django.template.response import SimpleTemplateResponse
from django.test import Client, TestCase, ignore_warnings, override_settings
from django.test import (
Client, SimpleTestCase, TestCase, ignore_warnings, override_settings,
)
from django.test.client import RedirectCycleError, RequestFactory, encode_file
from django.test.utils import ContextList, str_prefix
from django.utils._os import upath
@@ -52,7 +54,7 @@ class TestDataMixin(object):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class AssertContainsTests(TestCase):
class AssertContainsTests(SimpleTestCase):
def test_contains(self):
"Responses can be inspected for content, including counting repeated substrings"
@@ -322,7 +324,7 @@ class AssertTemplateUsedTests(TestDataMixin, TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class AssertRedirectsTests(TestCase):
class AssertRedirectsTests(SimpleTestCase):
def test_redirect_page(self):
"An assertion is raised if the original page couldn't be retrieved as expected"
@@ -529,7 +531,7 @@ class AssertRedirectsTests(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class AssertFormErrorTests(TestCase):
class AssertFormErrorTests(SimpleTestCase):
def test_unknown_form(self):
"An assertion is raised if the form name is unknown"
@@ -646,7 +648,7 @@ class AssertFormErrorTests(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class AssertFormsetErrorTests(TestCase):
class AssertFormsetErrorTests(SimpleTestCase):
msg_prefixes = [("", {}), ("abc: ", {"msg_prefix": "abc"})]
def setUp(self):
@@ -879,7 +881,7 @@ class SessionEngineTests(TestDataMixin, TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
class URLEscapingTests(TestCase):
class URLEscapingTests(SimpleTestCase):
def test_simple_argument_get(self):
"Get a view that has a simple string argument"
@@ -933,7 +935,7 @@ class ExceptionTests(TestDataMixin, TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class TemplateExceptionTests(TestCase):
class TemplateExceptionTests(SimpleTestCase):
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
@@ -953,7 +955,7 @@ class TemplateExceptionTests(TestCase):
# it was changed, and another one (without self.urls) to check it was reverted on
# teardown. This pair of tests relies upon the alphabetical ordering of test execution.
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class UrlconfSubstitutionTests(TestCase):
class UrlconfSubstitutionTests(SimpleTestCase):
def test_urlconf_was_changed(self):
"TestCase can enforce a custom URLconf on a per-test basis"
@@ -963,7 +965,7 @@ class UrlconfSubstitutionTests(TestCase):
# This test needs to run *after* UrlconfSubstitutionTests; the zz prefix in the
# name is to ensure alphabetical ordering.
class zzUrlconfSubstitutionTests(TestCase):
class zzUrlconfSubstitutionTests(SimpleTestCase):
def test_urlconf_was_reverted(self):
"""URLconf is reverted to original value after modification in a TestCase
@@ -1184,7 +1186,7 @@ class SessionTests(TestDataMixin, TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class RequestMethodTests(TestCase):
class RequestMethodTests(SimpleTestCase):
def test_get(self):
"Request a view via request method GET"
@@ -1232,7 +1234,7 @@ class RequestMethodTests(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class RequestMethodStringDataTests(TestCase):
class RequestMethodStringDataTests(SimpleTestCase):
def test_post(self):
"Request a view with string data via request method POST"
@@ -1270,7 +1272,7 @@ class RequestMethodStringDataTests(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
class QueryStringTests(TestCase):
class QueryStringTests(SimpleTestCase):
def test_get_like_requests(self):
# See: https://code.djangoproject.com/ticket/10571.
@@ -1316,7 +1318,7 @@ class QueryStringTests(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class UnicodePayloadTests(TestCase):
class UnicodePayloadTests(SimpleTestCase):
def test_simple_unicode_payload(self):
"A simple ASCII-only unicode JSON document can be POSTed"
@@ -1359,7 +1361,7 @@ class DummyFile(object):
return b'TEST_FILE_CONTENT'
class UploadedFileEncodingTest(TestCase):
class UploadedFileEncodingTest(SimpleTestCase):
def test_file_encoding(self):
encoded_file = encode_file('TEST_BOUNDARY', 'TEST_KEY', DummyFile('test_name.bin'))
self.assertEqual(b'--TEST_BOUNDARY', encoded_file[0])
@@ -1381,7 +1383,7 @@ class UploadedFileEncodingTest(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
class RequestHeadersTest(TestCase):
class RequestHeadersTest(SimpleTestCase):
def test_client_headers(self):
"A test client can receive custom headers"
response = self.client.get("/check_headers/", HTTP_X_ARG_CHECK='Testing 123')
@@ -1397,7 +1399,7 @@ class RequestHeadersTest(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class ReadLimitedStreamTest(TestCase):
class ReadLimitedStreamTest(SimpleTestCase):
"""
Tests that ensure that HttpRequest.body, HttpRequest.read() and
HttpRequest.read(BUFFER) have proper LimitedStream behavior.
@@ -1440,7 +1442,7 @@ class ReadLimitedStreamTest(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class RequestFactoryStateTest(TestCase):
class RequestFactoryStateTest(SimpleTestCase):
"""Regression tests for #15929."""
# These tests are checking that certain middleware don't change certain
# global state. Alternatively, from the point of view of a test, they are
@@ -1467,7 +1469,7 @@ class RequestFactoryStateTest(TestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class RequestFactoryEnvironmentTests(TestCase):
class RequestFactoryEnvironmentTests(SimpleTestCase):
"""
Regression tests for #8551 and #17067: ensure that environment variables
are set correctly in RequestFactory.