summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_management.py
diff options
context:
space:
mode:
authorFrançois Freitag <mail@franek.fr>2020-05-01 18:51:44 +0000
committerGitHub <noreply@github.com>2020-05-01 20:51:44 +0200
commita0df5dea3369fab02211d06c2b93109b2cb55175 (patch)
treeacd0fd40cb328a111fd3efb95533d78c53f17eb0 /tests/auth_tests/test_management.py
parentb4068bc65636cca6c2905aa8c40bea69bb0e4245 (diff)
Removed unnecessary inner methods in CreatesuperuserManagementCommandTestCase.
Diffstat (limited to 'tests/auth_tests/test_management.py')
-rw-r--r--tests/auth_tests/test_management.py64
1 files changed, 26 insertions, 38 deletions
diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
index 8b2d9775a2..0acdb4ece2 100644
--- a/tests/auth_tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -707,34 +707,26 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
def test_blank_username(self):
"""Creation fails if --username is blank."""
new_io = StringIO()
-
- def test(self):
- with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'):
- call_command(
- 'createsuperuser',
- username='',
- stdin=MockTTY(),
- stdout=new_io,
- stderr=new_io,
- )
-
- test(self)
+ with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'):
+ call_command(
+ 'createsuperuser',
+ username='',
+ stdin=MockTTY(),
+ stdout=new_io,
+ stderr=new_io,
+ )
def test_blank_username_non_interactive(self):
new_io = StringIO()
-
- def test(self):
- with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'):
- call_command(
- 'createsuperuser',
- username='',
- interactive=False,
- stdin=MockTTY(),
- stdout=new_io,
- stderr=new_io,
- )
-
- test(self)
+ with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'):
+ call_command(
+ 'createsuperuser',
+ username='',
+ interactive=False,
+ stdin=MockTTY(),
+ stdout=new_io,
+ stderr=new_io,
+ )
def test_password_validation_bypass(self):
"""
@@ -952,19 +944,15 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
@override_settings(AUTH_USER_MODEL='auth_tests.NoPasswordUser')
def test_usermodel_without_password(self):
new_io = StringIO()
-
- def test(self):
- call_command(
- 'createsuperuser',
- interactive=False,
- stdin=MockTTY(),
- stdout=new_io,
- stderr=new_io,
- username='username',
- )
- self.assertEqual(new_io.getvalue().strip(), 'Superuser created successfully.')
-
- test(self)
+ call_command(
+ 'createsuperuser',
+ interactive=False,
+ stdin=MockTTY(),
+ stdout=new_io,
+ stderr=new_io,
+ username='username',
+ )
+ self.assertEqual(new_io.getvalue().strip(), 'Superuser created successfully.')
@override_settings(AUTH_USER_MODEL='auth_tests.NoPasswordUser')
def test_usermodel_without_password_interactive(self):