CICD/app/widget/schema_test.py

28 lines
616 B
Python
Raw Normal View History

2019-05-19 14:22:53 +02:00
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'