Skip to content

Commit

Permalink
Merge branch 'feat_optional_inputs' into create_job_with_interface_th…
Browse files Browse the repository at this point in the history
…rough_api
  • Loading branch information
amickan committed Jan 17, 2025
2 parents e6301f4 + 50793e6 commit d94744d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/tests/algorithms_tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from tests.utils import recurse_callbacks


@pytest.mark.xfail(reason="Still to be addressed for optional inputs pitch")
@pytest.mark.django_db
def test_job_updated_start_and_complete_times_after_admin_requeue(
algorithm_image, settings, django_capture_on_commit_callbacks
Expand Down
18 changes: 16 additions & 2 deletions app/tests/algorithms_tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,12 @@ def test_create_job_with_json_file(
ci = ComponentInterfaceFactory(
kind=InterfaceKind.InterfaceKindChoices.ANY, store_in_database=False
)
ai.algorithm.inputs.set([ci])
interface = AlgorithmInterfaceFactory(
inputs=[ci],
)
ai.algorithm.interfaces.add(
interface, through_defaults={"is_default": True}
)

with tempfile.NamedTemporaryFile(mode="w+", suffix=".json") as file:
json.dump('{"Foo": "bar"}', file)
Expand All @@ -973,6 +978,7 @@ def test_create_job_with_json_file(
method=client.post,
reverse_kwargs={
"slug": ai.algorithm.slug,
"interface_pk": interface.pk,
},
user=editor,
follow=True,
Expand Down Expand Up @@ -1010,7 +1016,12 @@ def test_algorithm_job_create_with_image_input(
ci = ComponentInterfaceFactory(
kind=InterfaceKind.InterfaceKindChoices.IMAGE, store_in_database=False
)
ai.algorithm.inputs.set([ci])
interface = AlgorithmInterfaceFactory(
inputs=[ci],
)
ai.algorithm.interfaces.add(
interface, through_defaults={"is_default": True}
)

image1, image2 = ImageFactory.create_batch(2)
assign_perm("cases.view_image", editor, image1)
Expand All @@ -1025,6 +1036,7 @@ def test_algorithm_job_create_with_image_input(
method=client.post,
reverse_kwargs={
"slug": ai.algorithm.slug,
"interface_pk": interface.pk,
},
user=editor,
follow=True,
Expand All @@ -1049,6 +1061,7 @@ def test_algorithm_job_create_with_image_input(
method=client.post,
reverse_kwargs={
"slug": ai.algorithm.slug,
"interface_pk": interface.pk,
},
user=editor,
follow=True,
Expand Down Expand Up @@ -1076,6 +1089,7 @@ def test_algorithm_job_create_with_image_input(
method=client.post,
reverse_kwargs={
"slug": ai.algorithm.slug,
"interface_pk": interface.pk,
},
user=editor,
follow=True,
Expand Down

0 comments on commit d94744d

Please sign in to comment.