@@ -85,10 +85,10 @@ def all_server_paths(osparc_openapi_specs: dict[str, Any]) -> set[ServerPath]:
85
85
@pytest .fixture
86
86
def create_osparc_response_model (
87
87
osparc_openapi_specs : dict [str , Any ],
88
- ) -> Callable [[str ], BaseModel ]:
88
+ ) -> Callable [[type [ T ]], T ]:
89
89
def _create_model (model_type : type [T ]) -> T :
90
90
schemas = osparc_openapi_specs .get ("components" , {}).get ("schemas" , {})
91
- example_data = schemas .get (model_type .__name__ , {}).get ("example" , {} )
91
+ example_data = schemas .get (model_type .__name__ , {}).get ("example" )
92
92
error_msg = "Could not extract example data for"
93
93
error_msg += f" '{ model_type .__name__ } ' from openapi specs"
94
94
assert example_data , error_msg
@@ -103,7 +103,7 @@ def create_server_mock(
103
103
osparc_openapi_specs : dict [str , Any ],
104
104
all_server_paths : set [ServerPath ],
105
105
create_osparc_response_model : Callable [[str ], BaseModel ],
106
- ) -> Callable [[int , BaseModel ], None ]:
106
+ ) -> Callable [[int ], None ]:
107
107
def _mock_server (_status : int ) -> None :
108
108
def _sideeffect (
109
109
method : str ,
@@ -131,16 +131,16 @@ def _sideeffect(
131
131
.get (method .lower (), {})
132
132
.get ("responses" )
133
133
)
134
- assert (
135
- responses is not None
136
- ), f"status code { _status } is not a return code of { method .upper ()} { matching_path } "
134
+ assert responses is not None
137
135
schema = (
138
136
responses .get (f"{ _status } " , {})
139
137
.get ("content" , {})
140
138
.get ("application/json" , {})
141
139
.get ("schema" )
142
140
)
143
- assert schema is not None
141
+ assert (
142
+ schema is not None
143
+ ), f"probably status code { _status } is not a return code of { method .upper ()} { matching_path } "
144
144
response_model_type = getattr (osparc , schema .get ("title" ))
145
145
response_model = create_osparc_response_model (response_model_type )
146
146
response = HTTPResponse (
0 commit comments