mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Removed unnecessary inner methods in CreatesuperuserManagementCommandTestCase.
This commit is contained in:
		| @@ -707,34 +707,26 @@ class CreatesuperuserManagementCommandTestCase(TestCase): | |||||||
|     def test_blank_username(self): |     def test_blank_username(self): | ||||||
|         """Creation fails if --username is blank.""" |         """Creation fails if --username is blank.""" | ||||||
|         new_io = StringIO() |         new_io = StringIO() | ||||||
|  |         with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'): | ||||||
|         def test(self): |             call_command( | ||||||
|             with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'): |                 'createsuperuser', | ||||||
|                 call_command( |                 username='', | ||||||
|                     'createsuperuser', |                 stdin=MockTTY(), | ||||||
|                     username='', |                 stdout=new_io, | ||||||
|                     stdin=MockTTY(), |                 stderr=new_io, | ||||||
|                     stdout=new_io, |             ) | ||||||
|                     stderr=new_io, |  | ||||||
|                 ) |  | ||||||
|  |  | ||||||
|         test(self) |  | ||||||
|  |  | ||||||
|     def test_blank_username_non_interactive(self): |     def test_blank_username_non_interactive(self): | ||||||
|         new_io = StringIO() |         new_io = StringIO() | ||||||
|  |         with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'): | ||||||
|         def test(self): |             call_command( | ||||||
|             with self.assertRaisesMessage(CommandError, 'Username cannot be blank.'): |                 'createsuperuser', | ||||||
|                 call_command( |                 username='', | ||||||
|                     'createsuperuser', |                 interactive=False, | ||||||
|                     username='', |                 stdin=MockTTY(), | ||||||
|                     interactive=False, |                 stdout=new_io, | ||||||
|                     stdin=MockTTY(), |                 stderr=new_io, | ||||||
|                     stdout=new_io, |             ) | ||||||
|                     stderr=new_io, |  | ||||||
|                 ) |  | ||||||
|  |  | ||||||
|         test(self) |  | ||||||
|  |  | ||||||
|     def test_password_validation_bypass(self): |     def test_password_validation_bypass(self): | ||||||
|         """ |         """ | ||||||
| @@ -952,19 +944,15 @@ class CreatesuperuserManagementCommandTestCase(TestCase): | |||||||
|     @override_settings(AUTH_USER_MODEL='auth_tests.NoPasswordUser') |     @override_settings(AUTH_USER_MODEL='auth_tests.NoPasswordUser') | ||||||
|     def test_usermodel_without_password(self): |     def test_usermodel_without_password(self): | ||||||
|         new_io = StringIO() |         new_io = StringIO() | ||||||
|  |         call_command( | ||||||
|         def test(self): |             'createsuperuser', | ||||||
|             call_command( |             interactive=False, | ||||||
|                 'createsuperuser', |             stdin=MockTTY(), | ||||||
|                 interactive=False, |             stdout=new_io, | ||||||
|                 stdin=MockTTY(), |             stderr=new_io, | ||||||
|                 stdout=new_io, |             username='username', | ||||||
|                 stderr=new_io, |         ) | ||||||
|                 username='username', |         self.assertEqual(new_io.getvalue().strip(), 'Superuser created successfully.') | ||||||
|             ) |  | ||||||
|             self.assertEqual(new_io.getvalue().strip(), 'Superuser created successfully.') |  | ||||||
|  |  | ||||||
|         test(self) |  | ||||||
|  |  | ||||||
|     @override_settings(AUTH_USER_MODEL='auth_tests.NoPasswordUser') |     @override_settings(AUTH_USER_MODEL='auth_tests.NoPasswordUser') | ||||||
|     def test_usermodel_without_password_interactive(self): |     def test_usermodel_without_password_interactive(self): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user