Skip to content

Commit c4b55c2

Browse files
author
Constantinos Symeonides
committed
fix: Test coverage
1 parent efa5e95 commit c4b55c2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_parser/test_properties/test_init.py

+13
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,19 @@ def test_direct_properties_non_ref(self):
12811281
assert prop.optional_properties == [string_property(name="second", required=False, nullable=False)]
12821282
assert prop.required_properties == [string_property(name="first", required=True, nullable=False)]
12831283

1284+
def test_missing_ref(self):
1285+
from openapi_python_client.parser.properties import Schemas
1286+
1287+
data = oai.Schema.construct(
1288+
allOf=[oai.Schema.construct(properties={"prop": oai.Reference.construct(ref="DoesNotExist")})]
1289+
)
1290+
schemas = Schemas(models={"Foo": model_property(), "Bar": model_property()})
1291+
1292+
error, schemas = property_from_data(name="", data=data, schemas=schemas, parent_name=None, required=False)
1293+
1294+
assert isinstance(error, PropertyError)
1295+
assert "Reference not found" in error.detail
1296+
12841297

12851298
def test_build_schemas(mocker):
12861299
property_from_data = mocker.patch(f"{MODULE_NAME}.property_from_data")

0 commit comments

Comments
 (0)