Skip to content

Commit 236afbb

Browse files
committed
NRL-1053 tests
1 parent 8e1c186 commit 236afbb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

layer/nrlf/core/tests/test_model.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import pytest
2+
from pydantic import ValidationError
3+
14
from nrlf.core.model import (
25
ConnectionMetadata,
36
ConsumerRequestParams,
@@ -91,6 +94,30 @@ def test_consumer_request_params():
9194
assert params.nhs_number == "9999999999"
9295

9396

97+
def test_producer_request_params_extra_fields():
98+
with pytest.raises(ValidationError):
99+
ProducerRequestParams.model_validate(
100+
{
101+
"subject:identifier": "https://fhir.nhs.uk/Id/nhs-number|9999999999",
102+
"type": "test-type",
103+
"next-page-token": "page-token",
104+
"extra_field": "extra_value",
105+
}
106+
)
107+
108+
109+
def test_consumer_request_params_extra_fields():
110+
with pytest.raises(ValidationError):
111+
ConsumerRequestParams.model_validate(
112+
{
113+
"subject:identifier": "https://fhir.nhs.uk/Id/nhs-number|9999999999",
114+
"type": "test-type",
115+
"next-page-token": "page-token",
116+
"extra_field": "extra_value",
117+
}
118+
)
119+
120+
94121
def test_count_request_params():
95122
params = CountRequestParams.model_validate(
96123
{

0 commit comments

Comments
 (0)