-
Notifications
You must be signed in to change notification settings - Fork 13
/
conftest.py
46 lines (35 loc) · 905 Bytes
/
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
import pytest
from flask_jwt_extended import create_access_token
from app import create_app
from db import db
@pytest.fixture()
def app():
app = create_app("sqlite://")
app.config.update(
{
"TESTING": True,
}
)
with app.app_context():
db.create_all()
yield app
@pytest.fixture()
def client(app):
return app.test_client()
@pytest.fixture()
def fresh_jwt(app):
with app.app_context():
access_token = create_access_token(identity=1, fresh=True)
return access_token
@pytest.fixture()
def jwt(app):
with app.app_context():
access_token = create_access_token(identity=1)
return access_token
@pytest.fixture()
def admin_jwt(app):
with app.app_context():
access_token = create_access_token(
identity=1, additional_claims={"is_admin": True}
)
return access_token