5
5
6
6
from openapi_core import Config
7
7
from openapi_core import OpenAPI
8
+ from openapi_core import V30ResponseUnmarshaller
8
9
from openapi_core .testing import MockRequest
9
10
from openapi_core .testing import MockResponse
10
11
@@ -13,6 +14,13 @@ class TestParentReference:
13
14
14
15
spec_path = "data/v3.0/parent-reference/openapi.yaml"
15
16
17
+ @pytest .fixture
18
+ def unmarshaller (self , content_factory ):
19
+ content , base_uri = content_factory .from_file (self .spec_path )
20
+ return V30ResponseUnmarshaller (
21
+ spec = SchemaPath .from_dict (content , base_uri = base_uri )
22
+ )
23
+
16
24
@pytest .fixture
17
25
def openapi (self , content_factory ):
18
26
content , base_uri = content_factory .from_file (self .spec_path )
@@ -27,3 +35,11 @@ def test_valid(self, openapi):
27
35
)
28
36
29
37
openapi .validate_response (request , response )
38
+
39
+ def test_unmarshal (self , unmarshaller ):
40
+ request = MockRequest (host_url = "" , method = "GET" , path = "/books" )
41
+ response = MockResponse (
42
+ data = json .dumps ([{"id" : "BOOK:01" , "title" : "Test Book" }]).encode ()
43
+ )
44
+
45
+ unmarshaller .unmarshal (request , response )
0 commit comments