2019-05-19 16:56:56 +02:00
|
|
|
from pytest import fixture
|
|
|
|
|
|
|
|
from .model import Doodad
|
|
|
|
from .schema import DoodadSchema
|
|
|
|
from .interface import DoodadInterface
|
|
|
|
|
|
|
|
|
|
|
|
@fixture
|
|
|
|
def schema() -> DoodadSchema:
|
|
|
|
return DoodadSchema()
|
|
|
|
|
|
|
|
|
|
|
|
def test_DoodadSchema_create(schema: DoodadSchema):
|
|
|
|
assert schema
|
|
|
|
|
|
|
|
|
|
|
|
def test_DoodadSchema_works(schema: DoodadSchema):
|
2019-08-03 18:55:38 +02:00
|
|
|
params: DoodadInterface = schema.load(
|
|
|
|
{"doodadId": "123", "name": "Test doodad", "purpose": "Test purpose"}
|
|
|
|
).data
|
2019-05-19 16:56:56 +02:00
|
|
|
doodad = Doodad(**params)
|
|
|
|
|
|
|
|
assert doodad.doodad_id == 123
|
2019-08-03 18:55:38 +02:00
|
|
|
assert doodad.name == "Test doodad"
|
|
|
|
assert doodad.purpose == "Test purpose"
|