Users¶
These fixtures are related to Django users.
- pytest_djangoapp.fixtures.users.user(user_create) AbstractUser | AnonymousUser ¶
Exposes Django user object.
Shortcut for user_create fixture.
Example:
def test_this(user): username = user.username
Note
User password is accessible via password_plain attribute.
- pytest_djangoapp.fixtures.users.user_create(user_model)¶
Allows Django user object generation.
Example:
def test_this(user_create): user = user_create()
Note
User password is accessible via password_plain attribute.
- Parameters:
superuser – Whether to create a superuser.
anonymous – Whether to create an anonymous user.
attributes – Additional user object attributes to initialize.
- pytest_djangoapp.fixtures.users.user_model() AbstractUser | AnonymousUser ¶
Returns user model class.
Example:
def test_this(user_model): model_cls = user_model