generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_models_v1.py
43 lines (34 loc) · 1.09 KB
/
test_models_v1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from typing import Any
import pytest
from maloident.v1.models import IdentificationParameter, ResultNegative, ResultPositive
from .example_jsons_v1 import negative_response_body, positive_response_body, request_body
@pytest.mark.parametrize(
"json_dict",
[
request_body,
],
)
def test_request_model(json_dict: dict[str, Any]) -> None:
model = IdentificationParameter.model_validate(json_dict)
re_serialized = model.model_dump(mode="json")
assert re_serialized == json_dict
@pytest.mark.parametrize(
"json_dict",
[
positive_response_body,
],
)
def test_positive_response_model(json_dict: dict[str, Any]) -> None:
model = ResultPositive.model_validate(json_dict)
re_serialized = model.model_dump(mode="json")
assert re_serialized == json_dict
@pytest.mark.parametrize(
"json_dict",
[
negative_response_body,
],
)
def test_negative_response_model(json_dict: dict[str, Any]) -> None:
model = ResultNegative.model_validate(json_dict)
re_serialized = model.model_dump(mode="json")
assert re_serialized == json_dict