Add schema and interface tests
This commit is contained in:
19
app/other_api/whatsit/interface_test.py
Normal file
19
app/other_api/whatsit/interface_test.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from pytest import fixture
|
||||
from .model import Whatsit
|
||||
from .interface import WhatsitInterface
|
||||
|
||||
|
||||
@fixture
|
||||
def interface() -> WhatsitInterface:
|
||||
return WhatsitInterface(
|
||||
whatsit_id=1, name='Test whatsit', purpose='Test purpose'
|
||||
)
|
||||
|
||||
|
||||
def test_WhatsitInterface_create(interface: WhatsitInterface):
|
||||
assert interface
|
||||
|
||||
|
||||
def test_WhatsitInterface_works(interface: WhatsitInterface):
|
||||
whatsit = Whatsit(**interface)
|
||||
assert whatsit
|
@@ -0,0 +1,27 @@
|
||||
from pytest import fixture
|
||||
|
||||
from .model import Whatsit
|
||||
from .schema import WhatsitSchema
|
||||
from .interface import WhatsitInterface
|
||||
|
||||
|
||||
@fixture
|
||||
def schema() -> WhatsitSchema:
|
||||
return WhatsitSchema()
|
||||
|
||||
|
||||
def test_WhatsitSchema_create(schema: WhatsitSchema):
|
||||
assert schema
|
||||
|
||||
|
||||
def test_WhatsitSchema_works(schema: WhatsitSchema):
|
||||
params: WhatsitInterface = schema.load({
|
||||
'whatsitId': '123',
|
||||
'name': 'Test whatsit',
|
||||
'purpose': 'Test purpose'
|
||||
}).data
|
||||
whatsit = Whatsit(**params)
|
||||
|
||||
assert whatsit.whatsit_id == 123
|
||||
assert whatsit.name == 'Test whatsit'
|
||||
assert whatsit.purpose == 'Test purpose'
|
||||
|
Reference in New Issue
Block a user