This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/tests/conftest.py
Xavier Bustamante Talavera c4b6553c8c Prototyping
2018-04-10 17:06:39 +02:00

32 lines
698 B
Python

import pytest
from ereuse_devicehub.client import Client
from ereuse_devicehub.config import DevicehubConfig
from ereuse_devicehub.db import db
from ereuse_devicehub.devicehub import Devicehub
class TestConfig(DevicehubConfig):
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/dh_test'
SQLALCHEMY_BINDS = {
'common': 'postgresql://localhost/dh_test_common'
}
@pytest.fixture()
def config():
return TestConfig()
@pytest.fixture()
def app(config: TestConfig) -> Devicehub:
app = Devicehub(config=config, db=db)
db.create_all(app=app)
yield app
db.drop_all(app=app)
@pytest.fixture()
def client(app: Devicehub) -> Client:
return app.test_client()