aboutsummaryrefslogtreecommitdiff
path: root/src/tests/conftest.py
blob: 6a54ae4d15ad29a89b45c6bfc4b664c8f5a52903 (plain)
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
import pytest
from lb_app import create_app
from lb_app.app_db.db import MongoDB

import pprint

data = {'username': 'neo'}

@pytest.fixture
def app():
    app = create_app({
        'TESTING': True
    })

    app.config.from_mapping(
        MONGO_URI= 'mongodb://localhost:27017/test_liberationCenter'
    )


    with app.app_context():
        db = MongoDB(app)
        db.set_up()
        mongo = db.connection()
        mongo.db.users.insert_one(data)

    yield app

@pytest.fixture
def client(app):
    return app.test_client()

@pytest.fixture
def runner(app):
    return app.test_cli_runner()