diff --git a/tests/factories.py b/tests/factories.py index 5a18156..b2aab2a 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -4,8 +4,8 @@ Algorithm, ColorSpaceEnum, ComponentInterface, + HyperlinkedComponentInterfaceValue, HyperlinkedImage, - SimpleImage, ) pk_counter = 0 @@ -41,15 +41,23 @@ def ComponentInterfaceFactory(**kwargs) -> ComponentInterface: # noqa: N802 return ci -def SimpleImageFactory(**kwargs) -> SimpleImage: # noqa: N802 +def HyperlinkedComponentInterfaceValueFactory( # noqa: N802 + **kwargs, +) -> HyperlinkedComponentInterfaceValue: + pk = kwargs.get("pk") or _get_int_pk() - pk = kwargs.get("pk") or str(uuid.uuid4()) - si = SimpleImage(pk=pk, name=f"a_filename_{pk}.mha") + hciv = HyperlinkedComponentInterfaceValue( + pk=pk, + interface=ComponentInterfaceFactory(), + value=None, + file=None, + image=None, + ) for key, value in kwargs.items(): - setattr(si, key, value) + setattr(hciv, key, value) - return si + return hciv def HyperlinkedImageFactory(**kwargs) -> HyperlinkedImage: # noqa: N802 diff --git a/tests/test_models_proto.py b/tests/test_models_proto.py index 9b4c561..f16a653 100644 --- a/tests/test_models_proto.py +++ b/tests/test_models_proto.py @@ -16,8 +16,8 @@ from tests.factories import ( AlgorithmFactory, ComponentInterfaceFactory, + HyperlinkedComponentInterfaceValueFactory, HyperlinkedImageFactory, - SimpleImageFactory, ) from tests.utils import sync_generator_test @@ -170,8 +170,13 @@ def test_file_civ_validation(source, context, interface_kind): ], nullcontext(), ), - (SimpleImageFactory(), nullcontext()), (HyperlinkedImageFactory(), nullcontext()), + ( + HyperlinkedComponentInterfaceValueFactory( + image=HyperlinkedImageFactory().api_url + ), + nullcontext(), + ), ), ) @sync_generator_test