diff --git a/app/fizz/fizzbar/interface_test.py b/app/fizz/fizzbar/interface_test.py new file mode 100644 index 0000000..e69de29 diff --git a/app/widget/interface_test.py b/app/widget/interface_test.py new file mode 100644 index 0000000..da75bc8 --- /dev/null +++ b/app/widget/interface_test.py @@ -0,0 +1,19 @@ +from pytest import fixture +from .model import Widget +from .interface import WidgetInterface + + +@fixture +def interface() -> WidgetInterface: + return WidgetInterface( + widget_id=1, name='Test widget', purpose='Test purpose' + ) + + +def test_WidgetInterface_create(interface: WidgetInterface): + assert interface + + +def test_WidgetInterface_works(interface: WidgetInterface): + widget = Widget(**interface) + assert widget diff --git a/app/widget/model.py b/app/widget/model.py index fbcd9a9..5707376 100644 --- a/app/widget/model.py +++ b/app/widget/model.py @@ -1,7 +1,6 @@ from sqlalchemy import Integer, Column, String from app import db # noqa from .interface import WidgetInterface -from typing import Any class Widget(db.Model): # type: ignore diff --git a/app/widget/schema_test.py b/app/widget/schema_test.py index e69de29..9f4f702 100644 --- a/app/widget/schema_test.py +++ b/app/widget/schema_test.py @@ -0,0 +1,27 @@ +from pytest import fixture + +from .model import Widget +from .schema import WidgetSchema +from .interface import WidgetInterface + + +@fixture +def schema() -> WidgetSchema: + return WidgetSchema() + + +def test_WidgetSchema_create(schema: WidgetSchema): + assert schema + + +def test_WidgetSchema_works(schema: WidgetSchema): + params: WidgetInterface = schema.load({ + 'widgetId': '123', + 'name': 'Test widget', + 'purpose': 'Test purpose' + }).data + widget = Widget(**params) + + assert widget.widget_id == 123 + assert widget.name == 'Test widget' + assert widget.purpose == 'Test purpose'