-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that test doesn't autocreate users before
- Loading branch information
1 parent
749f76a
commit 10769db
Showing
2 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
from django.contrib.auth import get_user_model | ||
from django.core.management import call_command | ||
|
||
|
||
@pytest.mark.no_autocreate_users | ||
def test_create_debug_users(): | ||
admin = get_user_model().objects.filter(username="admin", is_superuser=True) | ||
student = get_user_model().objects.filter(username="student", is_student=True) | ||
teacher = get_user_model().objects.filter(username="teacher", is_teacher=True) | ||
|
||
assert not admin.exists() | ||
assert not teacher.exists() | ||
assert not student.exists() | ||
|
||
call_command("create_debug_users", noinput=True, verbosity=0) | ||
assert get_user_model().objects.filter(username="admin", is_superuser=True) | ||
assert get_user_model().objects.filter(username="student", is_student=True) | ||
assert get_user_model().objects.filter(username="teacher", is_teacher=True) | ||
|
||
assert admin.exists() | ||
assert teacher.exists() | ||
assert student.exists() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters