Changes between Initial Version and Version 1 of Ticket #28016, comment 5


Ignore:
Timestamp:
Apr 4, 2017, 11:35:27 PM (8 years ago)
Author:
Ricardo S. A. Silva

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28016, comment 5

    initial v1  
    11Done. PR updated.
    2 
    3 {{{
    4 --- a/tests/auth_tests/test_management.py
    5 +++ b/tests/auth_tests/test_management.py
    6 @@ -432,6 +432,38 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
    7                  stdout=new_io,
    8              )
    9 
    10 +    @mock_inputs({
    11 +        'password': 'nopasswd',
    12 +    })
    13 +    def test_invalid_username_by_command_line(self):
    14 +        """
    15 +        Creation should fail when an invalid username is inputted using --username
    16 +        """
    17 +        with self.assertRaises(CommandError):
    18 +            call_command(
    19 +                "createsuperuser",
    20 +                interactive=True,
    21 +                username="%invalid%username",
    22 +                stdin=MockTTY(),
    23 +            )
    24 +        self.assertEqual(CustomUser._default_manager.count(), 0)
    25 +
    26 +    @mock_inputs({
    27 +        'password': 'nopasswd',
    28 +    })
    29 +    def test_non_interactive_invalid_required_field(self):
    30 +        """
    31 +        Creation should fail when an invalid email is inputted using --email
    32 +        """
    33 +        with self.assertRaises(CommandError):
    34 +            call_command(
    35 +                "createsuperuser",
    36 +                interactive=True,
    37 +                email="%invalid%email",
    38 +                stdin=MockTTY(),
    39 +            )
    40 +        self.assertEqual(CustomUser._default_manager.count(), 0)
    41 +
    42 }}}
Back to Top