-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
40 lines (33 loc) · 814 Bytes
/
conftest.py
File metadata and controls
40 lines (33 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
The pytest fixtures module
"""
import pytest
from django.contrib.auth.models import User
from django.core.management import call_command
collect_ignore_glob = ["*/migrations/*"] # pylint: disable=invalid-name
@pytest.fixture(scope='session')
def django_db_setup(django_db_setup, django_db_blocker):
# pylint: disable=redefined-outer-name, unused-argument
"""
Loads fixtures
"""
with django_db_blocker.unblock():
call_command(
'loaddata',
'test/users',
'test/decks',
'test/cards',
'test/attempts',
)
@pytest.fixture
def admin():
"""
Return an admin user
"""
return User.objects.get(pk=1)
@pytest.fixture
def user():
"""
Return a common user
"""
return User.objects.get(pk=2)