You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

122 lines
2.5 KiB

import pytest
from access.factories import UserFactory, AccountFactory
from access import groups
@pytest.fixture
def admin():
"""
Create user as staff with data:
email = 'admin@example.com'
password = 'test'
is_staff = True
is_active = True
"""
user = UserFactory(
email='admin@example.com',
is_staff=True,
is_active=True,
groups__name=(groups.ADMIN,)
)
AccountFactory(owner=user)
return user
@pytest.fixture
def student():
"""
Create user as student with data:
email = 'student@example.com'
password = 'test'
is_active = True
in groups 'students'
"""
user = UserFactory.create(
email='student@example.com',
is_staff=False,
is_active=True,
groups__name=(groups.STUDENTS,)
)
AccountFactory(owner=user)
return user
@pytest.fixture
def student_not_active():
"""
Create user as student with data:
email = 'notactivestudent@example.com'
password = 'test'
is_active = False
in groups 'students'
"""
user = UserFactory.create(
email='notactivestudent@example.com',
is_staff=False,
is_active=False,
groups__name=(groups.STUDENTS,)
)
return user
@pytest.fixture
def manager():
"""
Create user as manager with data:
email = 'manager@example.com'
password = 'test'
is_staff = True
is_active = True
in groups 'managers'
"""
user = UserFactory.create(
email='manager@example.com',
is_staff=True,
is_active=True,
groups=(groups.MANAGERS,)
)
AccountFactory(owner=user)
return user
@pytest.fixture
def lead_manager():
"""
Create user as lead manager with data:
email = 'lead_manager@example.com'
password = 'test'
is_staff = True
is_active = True
in groups 'lead_managers'
"""
user = UserFactory.create(
email='lead_manager@example.com',
is_staff=True,
is_active=True,
groups=(groups.LEAD_MANAGERS,)
)
AccountFactory(owner=user)
return user
@pytest.fixture
def teacher():
"""
Create user as teacher with data:
email = 'teacher@example.com'
password = 'test'
is_staff = True
is_active = True
in groups 'teachers'
"""
user = UserFactory.create(
email='teacher@example.com',
is_staff=True,
is_active=True,
groups=(groups.TEACHERS,)
)
AccountFactory(owner=user)
return user