|
12 | 12 | INTERFACE_FORM_FIELD_PREFIX, |
13 | 13 | FlexibleFileField, |
14 | 14 | ) |
15 | | -from grandchallenge.components.models import ComponentInterfaceValue |
| 15 | +from grandchallenge.components.models import ( |
| 16 | + ComponentInterfaceValue, |
| 17 | + InterfaceKindChoices, |
| 18 | +) |
16 | 19 | from grandchallenge.notifications.models import Notification |
17 | 20 | from grandchallenge.profiles.templatetags.profiles import user_profile_link |
18 | 21 | from grandchallenge.reader_studies.interactive_algorithms import ( |
@@ -439,16 +442,16 @@ def test_display_set_update( |
439 | 442 | rs.add_editor(user) |
440 | 443 | # 3 interfaces of different types |
441 | 444 | ci_json = ComponentInterfaceFactory( |
442 | | - kind="JSON", |
| 445 | + kind=InterfaceKindChoices.ANY, |
443 | 446 | schema={ |
444 | 447 | "$schema": "http://json-schema.org/draft-07/schema", |
445 | 448 | "type": "object", |
446 | 449 | }, |
447 | 450 | ) |
448 | 451 | ci_json_file = ComponentInterfaceFactory( |
449 | | - kind="JSON", store_in_database=False |
| 452 | + kind=InterfaceKindChoices.ANY, store_in_database=False |
450 | 453 | ) |
451 | | - ci_img = ComponentInterfaceFactory(kind="IMG") |
| 454 | + ci_img = ComponentInterfaceFactory(kind=InterfaceKindChoices.PANIMG_IMAGE) |
452 | 455 | # create CIVs for those interfaces |
453 | 456 | im1, im2 = ImageFactory.create_batch(2) |
454 | 457 | assign_perm("cases.view_image", user, im2) |
@@ -624,12 +627,16 @@ def test_add_display_set_to_reader_study( |
624 | 627 | rs = ReaderStudyFactory() |
625 | 628 | ds1 = DisplaySetFactory(reader_study=rs) |
626 | 629 | rs.add_editor(u1) |
627 | | - ci_str = ComponentInterfaceFactory(kind="STR") |
628 | | - ci_img = ComponentInterfaceFactory(kind="IMG") |
| 630 | + ci_str = ComponentInterfaceFactory(kind=InterfaceKindChoices.STRING) |
| 631 | + ci_img = ComponentInterfaceFactory(kind=InterfaceKindChoices.PANIMG_IMAGE) |
629 | 632 |
|
630 | | - ci_img_new = ComponentInterfaceFactory(kind="IMG") |
631 | | - ci_str_new = ComponentInterfaceFactory(kind="STR") |
632 | | - ci_json = ComponentInterfaceFactory(kind="JSON", store_in_database=False) |
| 633 | + ci_img_new = ComponentInterfaceFactory( |
| 634 | + kind=InterfaceKindChoices.PANIMG_IMAGE |
| 635 | + ) |
| 636 | + ci_str_new = ComponentInterfaceFactory(kind=InterfaceKindChoices.STRING) |
| 637 | + ci_json = ComponentInterfaceFactory( |
| 638 | + kind=InterfaceKindChoices.ANY, store_in_database=False |
| 639 | + ) |
633 | 640 |
|
634 | 641 | im1, im2 = ImageFactory.create_batch(2) |
635 | 642 | civ_str = ComponentInterfaceValueFactory( |
@@ -721,7 +728,7 @@ def test_add_display_set_update_when_disabled(client): |
721 | 728 | rs = ReaderStudyFactory() |
722 | 729 | ds = DisplaySetFactory(reader_study=rs) |
723 | 730 | rs.add_editor(editor) |
724 | | - ci_str = ComponentInterfaceFactory(kind="STR") |
| 731 | + ci_str = ComponentInterfaceFactory(kind=InterfaceKindChoices.STRING) |
725 | 732 |
|
726 | 733 | # add an answer for the ds |
727 | 734 | AnswerFactory(question__reader_study=rs, display_set=ds, answer="true") |
@@ -749,9 +756,9 @@ def test_add_display_set_update_when_disabled(client): |
749 | 756 | @pytest.mark.parametrize( |
750 | 757 | "interface_kind, store_in_database, field_type", |
751 | 758 | ( |
752 | | - ("JSON", False, FlexibleFileField), |
753 | | - ("JSON", True, JSONField), |
754 | | - ("IMG", False, FlexibleImageField), |
| 759 | + (InterfaceKindChoices.ANY, False, FlexibleFileField), |
| 760 | + (InterfaceKindChoices.ANY, True, JSONField), |
| 761 | + (InterfaceKindChoices.PANIMG_IMAGE, False, FlexibleImageField), |
755 | 762 | ), |
756 | 763 | ) |
757 | 764 | @pytest.mark.django_db |
@@ -893,7 +900,7 @@ def test_display_set_upload_corrupt_image( |
893 | 900 | editor = UserFactory() |
894 | 901 | rs = ReaderStudyFactory() |
895 | 902 | rs.add_editor(editor) |
896 | | - ci_img = ComponentInterfaceFactory(kind="IMG") |
| 903 | + ci_img = ComponentInterfaceFactory(kind=InterfaceKindChoices.PANIMG_IMAGE) |
897 | 904 |
|
898 | 905 | im_upload = create_upload_from_file( |
899 | 906 | file_path=RESOURCE_PATH / "corrupt.png", |
|
0 commit comments