Skip to content

Commit

Permalink
🏷️ [#4398] Fix type errors in Objects API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Dec 4, 2024
1 parent 794ca2e commit 20cb7d0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ def test_submission_with_objects_api_backend_create_and_update_object(self):
"objecttype_version": 3,
"objects_api_group": objects_api_group,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -328,6 +329,7 @@ def test_submission_with_objects_api_backend_create_and_update_object(self):
"objecttype_version": 3,
"objects_api_group": objects_api_group,
"update_existing_object": True,
"auth_attribute_path": ["bsn"],
},
)

Expand Down Expand Up @@ -364,6 +366,7 @@ def test_submission_with_objects_api_backend_create_and_update_object(self):
"objecttype_version": 3,
"objects_api_group": objects_api_group,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -393,6 +396,7 @@ def test_submission_with_objects_api_backend_create_and_update_object(self):
"objecttype_version": 3,
"objects_api_group": objects_api_group,
"update_existing_object": True,
"auth_attribute_path": ["bsn"],
},
)

Expand Down Expand Up @@ -447,6 +451,7 @@ def test_prefer_dynamic_resolution_over_fixed_url(self):
"objecttype": UUID("527b8408-7421-4808-a744-43ccb7bdaaa2"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "attachment",
Expand Down Expand Up @@ -517,6 +522,7 @@ def test_create_document_documenttype_dynamically_resolved(self):
"objecttype": UUID("527b8408-7421-4808-a744-43ccb7bdaaa2"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "attachment",
Expand Down Expand Up @@ -580,6 +586,7 @@ def test_allow_registration_with_unpublished_document_types(self):
"objecttype": UUID("527b8408-7421-4808-a744-43ccb7bdaaa2"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "attachment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def test_submission_with_objects_api_backend_override_defaults(self):
"objecttype_version": 1,
"productaanvraag_type": "testproduct",
"update_existing_object": False,
"auth_attribute_path": [],
# `omschrijving` "PDF Informatieobjecttype other catalog":
"informatieobjecttype_submission_report": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/f2908f6f-aa07-42ef-8760-74c5234f2d25",
"upload_submission_csv": True,
Expand Down Expand Up @@ -240,6 +241,7 @@ def test_submission_with_objects_api_backend_override_defaults_upload_csv_defaul
"informatieobjecttype_submission_report": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/f2908f6f-aa07-42ef-8760-74c5234f2d25",
"upload_submission_csv": True,
"update_existing_object": False,
"auth_attribute_path": [],
"organisatie_rsin": "123456782",
"zaak_vertrouwelijkheidaanduiding": "geheim",
"doc_vertrouwelijkheidaanduiding": "geheim",
Expand Down Expand Up @@ -297,6 +299,7 @@ def test_submission_with_objects_api_backend_override_defaults_do_not_upload_csv
"objects_api_group": self.objects_api_group,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -329,6 +332,7 @@ def test_submission_with_objects_api_backend_missing_csv_iotype(self):
"objects_api_group": self.objects_api_group,
"upload_submission_csv": True,
"update_existing_object": False,
"auth_attribute_path": [],
"informatieobjecttype_submission_csv": "",
},
)
Expand Down Expand Up @@ -374,6 +378,7 @@ def test_submission_with_objects_api_backend_override_content_json(self):
"objects_api_group": self.objects_api_group,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": textwrap.dedent(
"""
{
Expand Down Expand Up @@ -438,6 +443,7 @@ def test_submission_with_objects_api_backend_use_config_defaults(self):
"objecttype": UUID("8faed0fa-7864-4409-aa6d-533a37616a9e"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -513,6 +519,7 @@ def test_submission_with_objects_api_backend_attachments(self):
"objecttype": UUID("8faed0fa-7864-4409-aa6d-533a37616a9e"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -623,6 +630,7 @@ def test_submission_with_objects_api_backend_attachments_specific_iotypen(self):
"objecttype": UUID("8faed0fa-7864-4409-aa6d-533a37616a9e"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -719,6 +727,7 @@ def test_submission_with_objects_api_backend_attachments_component_overwrites(se
"objecttype": UUID("8faed0fa-7864-4409-aa6d-533a37616a9e"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -802,6 +811,7 @@ def test_submission_with_objects_api_backend_attachments_component_inside_fields
"objecttype": UUID("8faed0fa-7864-4409-aa6d-533a37616a9e"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -861,6 +871,7 @@ def test_submission_with_objects_api_escapes_html(self):
"content_json": content_template,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -906,6 +917,7 @@ def test_submission_with_payment(self):
"objecttype": UUID("8faed0fa-7864-4409-aa6d-533a37616a9e"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
},
)

Expand Down Expand Up @@ -943,6 +955,7 @@ def test_submission_with_auth_context_data(self):
"informatieobjecttype_submission_report": "",
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": r"""{"auth": {% as_json variables.auth_context %}}""",
},
)
Expand Down Expand Up @@ -1003,6 +1016,7 @@ def test_submission_with_auth_context_data_not_authenticated(self):
"informatieobjecttype_submission_report": "",
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": r"""{"auth": {% as_json variables.auth_context %}}""",
},
)
Expand Down Expand Up @@ -1057,6 +1071,7 @@ def test_cosign_info_available(self):
"objecttype_version": 1,
"productaanvraag_type": "-dummy-",
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": textwrap.dedent(
"""
{
Expand Down Expand Up @@ -1103,6 +1118,7 @@ def test_cosign_info_not_available(self):
"objecttype_version": 1,
"productaanvraag_type": "-dummy-",
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": textwrap.dedent(
"""
{
Expand Down Expand Up @@ -1152,6 +1168,7 @@ def test_cosign_info_no_cosign_date(self):
"objecttype_version": 1,
"productaanvraag_type": "-dummy-",
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": textwrap.dedent(
"""
{
Expand Down Expand Up @@ -1184,6 +1201,7 @@ def test_payment_context_without_any_payment_attempts(self):
"objecttype_version": 1,
"productaanvraag_type": "-dummy-",
"update_existing_object": False,
"auth_attribute_path": [],
"content_json": """{"amount": {{ payment.amount }}}""",
}
handler = ObjectsAPIV1Handler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_submission_with_objects_api_v2(self):
"objecttype_version": 3,
"upload_submission_csv": True,
"update_existing_object": False,
"auth_attribute_path": [],
"informatieobjecttype_submission_report": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b",
"informatieobjecttype_submission_csv": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3",
"informatieobjecttype_attachment": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7",
Expand Down Expand Up @@ -193,6 +194,7 @@ def test_submission_with_objects_api_v2_with_payment_attributes(self):
"objecttype_version": 3,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "payment_completed",
Expand Down Expand Up @@ -293,6 +295,7 @@ def test_submission_with_file_components(self):
"objecttype_version": 1,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"informatieobjecttype_attachment": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7",
"organisatie_rsin": "000000000",
"variables_mapping": [
Expand Down Expand Up @@ -369,6 +372,7 @@ def test_submission_with_file_components_container_variable(self):
"objecttype_version": 1,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"informatieobjecttype_attachment": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7",
"organisatie_rsin": "000000000",
"variables_mapping": [
Expand Down Expand Up @@ -415,6 +419,7 @@ def test_submission_with_empty_optional_file(self):
"objecttype_version": 1,
"upload_submission_csv": False,
"update_existing_object": False,
"auth_attribute_path": [],
"informatieobjecttype_attachment": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7",
"organisatie_rsin": "000000000",
"variables_mapping": [
Expand Down Expand Up @@ -475,6 +480,7 @@ def test_addressNl_legacy_before_of_30(self):
"objecttype": "8faed0fa-7864-4409-aa6d-533a37616a9e",
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "addressNl",
Expand Down Expand Up @@ -549,6 +555,7 @@ def test_submission_with_map_component_inside_data(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "location",
Expand Down Expand Up @@ -596,6 +603,7 @@ def test_layout_components(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "fieldset.textfield",
Expand Down Expand Up @@ -639,6 +647,7 @@ def test_hidden_component(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "textfield",
Expand Down Expand Up @@ -670,6 +679,7 @@ def test_public_reference_available(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "public_reference",
Expand Down Expand Up @@ -716,6 +726,7 @@ def test_cosign_info_available(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "cosign_data",
Expand Down Expand Up @@ -778,6 +789,7 @@ def test_cosign_info_not_available(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "cosign_date",
Expand Down Expand Up @@ -833,6 +845,7 @@ def test_cosign_info_no_cosign_date(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "cosign_date",
Expand Down Expand Up @@ -872,6 +885,7 @@ def test_auth_context_data_info_available(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "auth_context",
Expand Down Expand Up @@ -983,6 +997,7 @@ def test_auth_context_data_info_parts_missing_variants(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "auth_context",
Expand Down Expand Up @@ -1142,6 +1157,7 @@ def test_addressNl_with_specific_target_paths(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "addressNl",
Expand Down Expand Up @@ -1208,6 +1224,7 @@ def test_addressNl_with_specific_target_paths_mapped_and_empty_submitted_data(
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{
"variable_key": "addressNl",
Expand Down Expand Up @@ -1270,6 +1287,7 @@ def test_addressNl_with_object_target_path(self):
"objecttype": UUID("f3f1b370-97ed-4730-bc7e-ebb20c230377"),
"objecttype_version": 1,
"update_existing_object": False,
"auth_attribute_path": [],
"variables_mapping": [
{"variable_key": "addressNl", "target_path": ["addressNL"]}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ def test_auth_attribute_path_required_if_update_existing_object_is_true(self):
},
)

self.assertFalse(options.is_valid())
result = options.is_valid()

self.assertFalse(result)
self.assertIn("auth_attribute_path", options.errors)
error = options.errors["auth_attribute_path"][0]
self.assertEqual(error.code, "required")
Expand Down

0 comments on commit 20cb7d0

Please sign in to comment.