-
Notifications
You must be signed in to change notification settings - Fork 2
/
conftest.py
106 lines (69 loc) · 1.83 KB
/
conftest.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from datetime import timedelta
import pytest
from django.utils import timezone
from users.tests.factories import UserFactory
from events.tests.factories import EventFactory
from events.tests.factories import OrganizerFactory
from events.tests.factories import SpeakerFactory
from books.tests.factories import BookFactory
from places.tests.factories import PlaceFactory
from places.tests.factories import CityFactory
from blog.tests.factories import PostFactory as BlogPostFactory
from specials.tests.factories import SpecialFactory
@pytest.fixture
def user():
return UserFactory()
@pytest.fixture
def other_user():
return UserFactory()
@pytest.fixture
def user_admin():
return UserFactory(
is_staff=True,
is_superuser=True,
)
@pytest.fixture
def organizer():
return OrganizerFactory()
@pytest.fixture
def event():
return EventFactory()
@pytest.fixture
def event_with_organizer(event, organizer):
event.organizers.add(organizer)
return event
@pytest.fixture
def other_event():
return EventFactory()
@pytest.fixture
def not_published_event():
return EventFactory(is_published=False)
@pytest.fixture
def not_approved_event():
return EventFactory(is_approved=False)
@pytest.fixture
def past_event():
return EventFactory(
event_date=timezone.now() - timedelta(days=1)
)
@pytest.fixture
def book(event):
return BookFactory(related_events=[event])
@pytest.fixture
def other_event_book(other_event):
return BookFactory(related_events=[other_event])
@pytest.fixture
def place():
return PlaceFactory()
@pytest.fixture
def speaker():
return SpeakerFactory()
@pytest.fixture
def city():
return CityFactory()
@pytest.fixture
def blog_post():
return BlogPostFactory()
@pytest.fixture
def special(event):
return SpecialFactory(related_events=[event])