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 Doodad
|
|
|
|
|
|
|
|
|
|
|
|
@fixture
|
|
|
|
def doodad() -> Doodad:
|
2019-08-03 18:55:38 +02:00
|
|
|
return Doodad(doodad_id=1, name="Test doodad", purpose="Test purpose")
|
2019-05-18 19:47:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_Doodad_create(doodad: Doodad):
|
|
|
|
assert doodad
|
|
|
|
|
|
|
|
|
|
|
|
def test_Doodad_retrieve(doodad: Doodad, db: SQLAlchemy): # noqa
|
|
|
|
db.session.add(doodad)
|
|
|
|
db.session.commit()
|
|
|
|
s = Doodad.query.first()
|
|
|
|
assert s.__dict__ == doodad.__dict__
|