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):
|
2019-08-03 18:55:38 +02:00
|
|
|
params: WidgetInterface = schema.load(
|
|
|
|
{"widgetId": "123", "name": "Test widget", "purpose": "Test purpose"}
|
2020-01-22 17:42:52 +01:00
|
|
|
)
|
2019-05-19 14:22:53 +02:00
|
|
|
widget = Widget(**params)
|
|
|
|
|
|
|
|
assert widget.widget_id == 123
|
2019-08-03 18:55:38 +02:00
|
|
|
assert widget.name == "Test widget"
|
|
|
|
assert widget.purpose == "Test purpose"
|