Skip to content

Commit

Permalink
✅ [#4796] Added test for 'productenOfDiensten' in ZGW API zaak post
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen committed Oct 30, 2024
1 parent 14fd916 commit 2ae68e4
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions src/openforms/registrations/contrib/zgw_apis/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,84 @@ def test_submission_with_registrator(self, m):
"123456782",
)

def test_submission_with_product(self, m):
submission = SubmissionFactory.from_components(
[
{
"key": "voorletters",
"type": "textfield",
"registration": {
"attribute": RegistrationAttribute.initiator_voorletters,
},
},
],
submitted_data={
"voornaam": "Foo",
},
bsn="111222333",
form__product__price=Decimal("0"),
form__payment_backend="demo",
language_code="en",
completed=True,
)
zgw_form_options: RegistrationOptions = {
"zgw_api_group": self.zgw_group,
"case_type_identification": "",
"zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1",
"informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1",
"organisatie_rsin": "000000000",
"product": "https://example.com",
"zaak_vertrouwelijkheidaanduiding": "openbaar",
"doc_vertrouwelijkheidaanduiding": "openbaar",
}
self.install_mocks(m)

plugin = ZGWRegistration("zgw")
pre_registration_result = plugin.pre_register_submission(
submission, zgw_form_options
)
submission.registration_result.update(pre_registration_result.data)
submission.save()
result = plugin.register_submission(submission, zgw_form_options)
assert result

self.assertEqual(
result["document"]["url"],
"https://documenten.nl/api/v1/enkelvoudiginformatieobjecten/1",
)
self.assertEqual(result["rol"]["url"], "https://zaken.nl/api/v1/rollen/1")
self.assertEqual(result["status"]["url"], "https://zaken.nl/api/v1/statussen/1")
self.assertEqual(result["zaak"]["url"], "https://zaken.nl/api/v1/zaken/1")
self.assertEqual(
result["zaak"]["zaaktype"], "https://catalogi.nl/api/v1/zaaktypen/1"
)

create_zaak = m.request_history[0]

with self.subTest("Create zaak call"):
create_zaak_body = create_zaak.json()

self.assertNotIn("kenmerken", create_zaak_body)
self.assertEqual(create_zaak.method, "POST")
self.assertEqual(create_zaak.url, "https://zaken.nl/api/v1/zaken")
self.assertEqual(create_zaak_body["bronorganisatie"], "000000000")
self.assertEqual(
create_zaak_body["verantwoordelijkeOrganisatie"],
"000000000",
)
self.assertEqual(
create_zaak_body["productenOfDiensten"],
["https://example.com"],
)
self.assertEqual(
create_zaak_body["vertrouwelijkheidaanduiding"],
"openbaar",
)
self.assertEqual(
create_zaak_body["zaaktype"], "https://catalogi.nl/api/v1/zaaktypen/1"
)
self.assertEqual(create_zaak_body["betalingsindicatie"], "nvt")

def test_submission_roltype_initiator_not_found(self, m):
submission = SubmissionFactory.create(
completed=True,
Expand Down

0 comments on commit 2ae68e4

Please sign in to comment.