-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathconftest.py
More file actions
59 lines (43 loc) · 1.24 KB
/
conftest.py
File metadata and controls
59 lines (43 loc) · 1.24 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
import os
from typing import Any, Dict, Optional
import pytest
from fastapi_users import schemas
DATABASE_URL = os.getenv(
"DATABASE_URL", "sqlite+aiosqlite:///./test-sqlalchemy-user.db"
)
SYNC_DATABASE_URL = os.getenv(
"SYNC_DATABASE_URL", "sqlite:///./test-sqlalchemy-user.db"
)
class User(schemas.BaseUser):
first_name: Optional[str]
class UserCreate(schemas.BaseUserCreate):
first_name: Optional[str]
class UserUpdate(schemas.BaseUserUpdate):
pass
class UserOAuth(User, schemas.BaseOAuthAccountMixin):
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() -> Dict[str, Any]:
return {
"oauth_name": "service1",
"access_token": "TOKEN",
"expires_at": 1579000751,
"account_id": "user_oauth1",
"account_email": "king.arthur@camelot.bt",
}
@pytest.fixture
def oauth_account2() -> Dict[str, Any]:
return {
"oauth_name": "service2",
"access_token": "TOKEN",
"expires_at": 1579000751,
"account_id": "user_oauth2",
"account_email": "king.arthur@camelot.bt",
}