-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathevent_fixture.py
117 lines (98 loc) · 2.91 KB
/
event_fixture.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
107
108
109
110
111
112
113
114
115
116
117
from datetime import datetime, timedelta
import pytest
from sqlalchemy.orm import Session
from app.database.models import Category, Event, User
from app.routers.event import create_event
today_date = datetime.today().replace(hour=0, minute=0, second=0)
@pytest.fixture
def event(sender: User, category: Category, session: Session) -> Event:
return create_event(
db=session,
title='event',
start=today_date,
end=today_date,
content='test event',
owner_id=sender.id,
location="Some random location",
vc_link=None,
category_id=category.id,
)
@pytest.fixture
def today_event(sender: User, session: Session) -> Event:
return create_event(
db=session,
title='event 1',
start=today_date + timedelta(hours=7),
end=today_date + timedelta(hours=9),
all_day=False,
content='test event',
owner_id=sender.id,
)
@pytest.fixture
def today_event_2(sender: User, session: Session) -> Event:
return create_event(
db=session,
title='event 2',
start=today_date + timedelta(hours=3),
end=today_date + timedelta(days=2, hours=3),
all_day=False,
content='test event',
owner_id=sender.id,
)
@pytest.fixture
def yesterday_event(sender: User, session: Session) -> Event:
return create_event(
db=session,
title='event 3',
start=today_date - timedelta(hours=8),
end=today_date,
all_day=False,
content='test event',
owner_id=sender.id,
)
@pytest.fixture
def next_week_event(sender: User, session: Session) -> Event:
return create_event(
db=session,
title='event 4',
start=today_date + timedelta(days=7, hours=2),
end=today_date + timedelta(days=7, hours=4),
all_day=False,
content='test event',
owner_id=sender.id,
)
@pytest.fixture
def next_month_event(sender: User, session: Session) -> Event:
return create_event(
db=session,
title='event 5',
start=today_date + timedelta(days=20, hours=4),
end=today_date + timedelta(days=20, hours=6),
all_day=False,
content='test event',
owner_id=sender.id,
)
@pytest.fixture
def old_event(sender: User, session: Session) -> Event:
return create_event(
db=session,
title='event 6',
start=today_date - timedelta(days=5),
end=today_date - timedelta(days=1),
all_day=False,
content='test event',
owner_id=sender.id,
)
@pytest.fixture
def all_day_event(sender: User, category: Category, session: Session) -> Event:
return create_event(
db=session,
title='event',
start=today_date,
end=today_date,
all_day=True,
content='test event',
owner_id=sender.id,
location="Some random location",
category_id=category.id,
)