-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconftest.py
More file actions
59 lines (40 loc) · 1.16 KB
/
conftest.py
File metadata and controls
59 lines (40 loc) · 1.16 KB
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
import asyncio
from typing import Optional
import pytest
from fastapi_users import models
class User(models.BaseUser):
first_name: Optional[str]
class UserCreate(models.BaseUserCreate):
first_name: Optional[str]
class UserUpdate(models.BaseUserUpdate):
pass
class UserDB(User, models.BaseUserDB):
pass
class UserOAuth(User, models.BaseOAuthAccountMixin):
pass
class UserDBOAuth(UserOAuth, UserDB):
pass
@pytest.fixture(scope="session")
def event_loop():
"""Force the pytest-asyncio loop to be the main one."""
loop = asyncio.new_event_loop()
yield loop
loop.close()
@pytest.fixture
def oauth_account1() -> models.BaseOAuthAccount:
return models.BaseOAuthAccount(
oauth_name="service1",
access_token="TOKEN",
expires_at=1579000751,
account_id="user_oauth1",
account_email="king.arthur@camelot.bt",
)
@pytest.fixture
def oauth_account2() -> models.BaseOAuthAccount:
return models.BaseOAuthAccount(
oauth_name="service2",
access_token="TOKEN",
expires_at=1579000751,
account_id="user_oauth2",
account_email="king.arthur@camelot.bt",
)