-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
39 lines (29 loc) · 856 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
import pytest
from app import db
from flask.signals import request_finished
@pytest.fixture
def app():
# create the app with a test config dictionary
app = create_app({"TESTING": True})
# @request_finished.connect_via(app)
# def expire_session(sender, response, **extra):
# db.session.remove()
with app.app_context():
db.create_all()
yield app
# close and remove the temporary database
with app.app_context():
db.drop_all()
@pytest.fixture
def client(app):
return app.test_client()
# This fixture gets called in every test that
# references "one_board"
# This fixture creates a task and saves it in the database
# @pytest.fixture
def one_board(app):
new_board = Board(
name="Create the future",
owner="Ada")
db.session.add(new_board)
db.session.commit()