mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Switched TestCase to SimpleTestCase where possible in Django's tests.
This commit is contained in:
parent
f091ea3515
commit
193c109327
37 changed files with 130 additions and 134 deletions
|
@ -7,7 +7,7 @@ from django.contrib.auth.mixins import (
|
|||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import HttpResponse
|
||||
from django.test import RequestFactory, TestCase
|
||||
from django.test import RequestFactory, SimpleTestCase, TestCase
|
||||
from django.views.generic import View
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ class AccessMixinTests(TestCase):
|
|||
view(request)
|
||||
|
||||
|
||||
class UserPassesTestTests(TestCase):
|
||||
class UserPassesTestTests(SimpleTestCase):
|
||||
|
||||
factory = RequestFactory()
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class UserManagerTestCase(TestCase):
|
|||
self.assertIn(char, allowed_chars)
|
||||
|
||||
|
||||
class AbstractBaseUserTests(TestCase):
|
||||
class AbstractBaseUserTests(SimpleTestCase):
|
||||
|
||||
def test_has_usable_password(self):
|
||||
"""
|
||||
|
|
|
@ -11,7 +11,7 @@ from django.contrib.auth.password_validation import (
|
|||
)
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test import SimpleTestCase, TestCase, override_settings
|
||||
from django.test.utils import isolate_apps
|
||||
from django.utils.html import conditional_escape
|
||||
|
||||
|
@ -22,7 +22,7 @@ from django.utils.html import conditional_escape
|
|||
'min_length': 12,
|
||||
}},
|
||||
])
|
||||
class PasswordValidationTest(TestCase):
|
||||
class PasswordValidationTest(SimpleTestCase):
|
||||
def test_get_default_password_validators(self):
|
||||
validators = get_default_password_validators()
|
||||
self.assertEqual(len(validators), 2)
|
||||
|
@ -95,7 +95,7 @@ class PasswordValidationTest(TestCase):
|
|||
self.assertEqual(password_validators_help_text_html(), '')
|
||||
|
||||
|
||||
class MinimumLengthValidatorTest(TestCase):
|
||||
class MinimumLengthValidatorTest(SimpleTestCase):
|
||||
def test_validate(self):
|
||||
expected_error = "This password is too short. It must contain at least %d characters."
|
||||
self.assertIsNone(MinimumLengthValidator().validate('12345678'))
|
||||
|
@ -182,7 +182,7 @@ class UserAttributeSimilarityValidatorTest(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class CommonPasswordValidatorTest(TestCase):
|
||||
class CommonPasswordValidatorTest(SimpleTestCase):
|
||||
def test_validate(self):
|
||||
expected_error = "This password is too common."
|
||||
self.assertIsNone(CommonPasswordValidator().validate('a-safe-password'))
|
||||
|
@ -214,7 +214,7 @@ class CommonPasswordValidatorTest(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class NumericPasswordValidatorTest(TestCase):
|
||||
class NumericPasswordValidatorTest(SimpleTestCase):
|
||||
def test_validate(self):
|
||||
expected_error = "This password is entirely numeric."
|
||||
self.assertIsNone(NumericPasswordValidator().validate('a-safe-password'))
|
||||
|
@ -231,7 +231,7 @@ class NumericPasswordValidatorTest(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class UsernameValidatorsTests(TestCase):
|
||||
class UsernameValidatorsTests(SimpleTestCase):
|
||||
def test_unicode_validator(self):
|
||||
valid_usernames = ['joe', 'René', 'ᴮᴵᴳᴮᴵᴿᴰ', 'أحمد']
|
||||
invalid_usernames = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue