aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/users/tests/test_managers.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-10-15 21:01:31 +0100
committerMatthew Lemon <y@yulqen.org>2024-10-15 21:01:31 +0100
commiteeaddb27560d723ca7d61359744ceb2709fccd2d (patch)
tree04ddbc49ae7b73d5f5a9e1716d7227aecd3b9f85 /pyblackbird_cc/users/tests/test_managers.py
parent7a3044c859043837e6c7c95bb4894d04e9b2cbc2 (diff)
Renamed from pyblackbird_cc to alphabetlearning - everywhere
Diffstat (limited to 'pyblackbird_cc/users/tests/test_managers.py')
-rw-r--r--pyblackbird_cc/users/tests/test_managers.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/pyblackbird_cc/users/tests/test_managers.py b/pyblackbird_cc/users/tests/test_managers.py
deleted file mode 100644
index 66cad8d..0000000
--- a/pyblackbird_cc/users/tests/test_managers.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from io import StringIO
-
-import pytest
-from django.core.management import call_command
-
-from pyblackbird_cc.users.models import User
-
-
-@pytest.mark.django_db()
-class TestUserManager:
- def test_create_user(self):
- user = User.objects.create_user(
- email="john@example.com",
- password="something-r@nd0m!", # noqa: S106
- )
- assert user.email == "john@example.com"
- assert not user.is_staff
- assert not user.is_superuser
- assert user.check_password("something-r@nd0m!")
- assert user.username is None
-
- def test_create_superuser(self):
- user = User.objects.create_superuser(
- email="admin@example.com",
- password="something-r@nd0m!", # noqa: S106
- )
- assert user.email == "admin@example.com"
- assert user.is_staff
- assert user.is_superuser
- assert user.username is None
-
- def test_create_superuser_username_ignored(self):
- user = User.objects.create_superuser(
- email="test@example.com",
- password="something-r@nd0m!", # noqa: S106
- )
- assert user.username is None
-
-
-@pytest.mark.django_db()
-def test_createsuperuser_command():
- """Ensure createsuperuser command works with our custom manager."""
- out = StringIO()
- command_result = call_command(
- "createsuperuser",
- "--email",
- "henry@example.com",
- interactive=False,
- stdout=out,
- )
-
- assert command_result is None
- assert out.getvalue() == "Superuser created successfully.\n"
- user = User.objects.get(email="henry@example.com")
- assert not user.has_usable_password()