File tree 1 file changed +21
-0
lines changed
tests/test_openapi_parser
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -225,3 +225,24 @@ def test_parse_request_json_body_no_data(self):
225
225
result = Endpoint .parse_request_json_body (body )
226
226
227
227
assert result is None
228
+
229
+
230
+ class TestImportStringFromReference :
231
+ def test_import_string_from_reference_no_prefix (self , mocker ):
232
+ from openapi_python_client .openapi_parser .openapi import import_string_from_reference
233
+ from openapi_python_client .openapi_parser .reference import Reference
234
+
235
+ reference = mocker .MagicMock (autospec = Reference )
236
+ result = import_string_from_reference (reference )
237
+
238
+ assert result == f"from .{ reference .module_name } import { reference .class_name } "
239
+
240
+ def test_import_string_from_reference_with_prefix (self , mocker ):
241
+ from openapi_python_client .openapi_parser .openapi import import_string_from_reference
242
+ from openapi_python_client .openapi_parser .reference import Reference
243
+
244
+ prefix = mocker .MagicMock (autospec = str )
245
+ reference = mocker .MagicMock (autospec = Reference )
246
+ result = import_string_from_reference (reference = reference , prefix = prefix )
247
+
248
+ assert result == f"from { prefix } .{ reference .module_name } import { reference .class_name } "
You can’t perform that action at this time.
0 commit comments