2019-05-18 19:47:47 +02:00
|
|
|
from pytest import fixture
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from app.test.fixtures import app, db # noqa
|
|
|
|
from .model import Whatsit
|
|
|
|
|
|
|
|
|
|
|
|
@fixture
|
|
|
|
def whatsit() -> Whatsit:
|
2019-08-03 18:55:38 +02:00
|
|
|
return Whatsit(whatsit_id=1, name="Test whatsit", purpose="Test purpose")
|
2019-05-18 19:47:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_Whatsit_create(whatsit: Whatsit):
|
|
|
|
assert whatsit
|
|
|
|
|
|
|
|
|
|
|
|
def test_Whatsit_retrieve(whatsit: Whatsit, db: SQLAlchemy): # noqa
|
|
|
|
db.session.add(whatsit)
|
|
|
|
db.session.commit()
|
|
|
|
s = Whatsit.query.first()
|
|
|
|
assert s.__dict__ == whatsit.__dict__
|