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