summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_management.py
diff options
context:
space:
mode:
authorMarcelo Galigniana <marcelogaligniana@gmail.com>2022-09-26 09:56:50 -0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-27 09:57:16 +0200
commit67c34c1a3718f6d0a18bd72ca6a9795d9f4ee251 (patch)
tree75632a974972ccbff657562867685dea8a8ea5ce /tests/auth_tests/test_management.py
parentf08651c06cb5fe5a6181354e053bf82fe8d68f16 (diff)
Completed test coverage for createsuperuser command.
Diffstat (limited to 'tests/auth_tests/test_management.py')
-rw-r--r--tests/auth_tests/test_management.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
index 5d695e42a6..f567fd0dc1 100644
--- a/tests/auth_tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -312,6 +312,19 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
# created password should be unusable
self.assertFalse(u.has_usable_password())
+ def test_validate_username(self):
+ msg = (
+ "Enter a valid username. This value may contain only letters, numbers, "
+ "and @/./+/-/_ characters."
+ )
+ with self.assertRaisesMessage(CommandError, msg):
+ call_command(
+ "createsuperuser",
+ interactive=False,
+ username="🤠",
+ email="joe@somewhere.org",
+ )
+
def test_non_ascii_verbose_name(self):
@mock_inputs(
{