Skip to content

Commit

Permalink
[#1791] Update mocks and fix failing test(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma committed Nov 1, 2023
1 parent bdcd1d6 commit b30845d
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 2 deletions.
38 changes: 37 additions & 1 deletion src/open_inwoner/cms/cases/tests/test_contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ def setUp(self):
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar,
indicatieInternOfExtern="extern",
)
#
# statuses
#
self.status_new = generate_oas_component(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da81560-c7fc-476a-ad13-beu760sle929",
zaak=self.zaak["url"],
statustype=f"{CATALOGI_ROOT}statustypen/e3798107-ab27-4c3c-977d-777yu878km09",
datumStatusGezet="2021-01-12",
statustoelichting="",
)
self.status_finish = generate_oas_component(
"zrc",
"schemas/Status",
Expand All @@ -122,14 +134,32 @@ def setUp(self):
datumStatusGezet="2021-03-12",
statustoelichting="",
)
#
# status types
#
self.status_type_new = generate_oas_component(
"ztc",
"schemas/StatusType",
url=self.status_new["statustype"],
zaaktype=self.zaaktype["url"],
catalogus=f"{CATALOGI_ROOT}catalogussen/1b643db-81bb-d71bd5a2317a",
omschrijving="Initial request",
omschrijvingGeneriek="Nieuw",
statustekst="",
volgnummer=1,
isEindstatus=False,
)
self.status_type_finish = generate_oas_component(
"ztc",
"schemas/StatusType",
url=self.status_finish["statustype"],
zaaktype=self.zaaktype["url"],
catalogus=f"{CATALOGI_ROOT}catalogussen/1b643db-81bb-d71bd5a2317a",
omschrijving="Finish",
omschrijvingGeneriek="some content",
omschrijvingGeneriek="Afgehandeld",
statustekst="",
volgnummer=1,
isEindstatus=True,
)
self.result = generate_oas_component(
"zrc",
Expand Down Expand Up @@ -181,6 +211,12 @@ def _setUpMocks(self, m):
]:
self.matchers.append(m.get(resource["url"], json=resource))

# mock `fetch_status_types_no_cache`
m.get(
f"{CATALOGI_ROOT}statustypen?zaaktype={self.zaak['zaaktype']}",
json=paginated_response([self.status_type_new, self.status_type_finish]),
)

self.matchers += [
m.get(
f"{ZAKEN_ROOT}rollen?zaak={self.zaak['url']}",
Expand Down
38 changes: 37 additions & 1 deletion src/open_inwoner/cms/cases/tests/test_htmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ def setUp(self) -> None:
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar,
indicatieInternOfExtern="extern",
)
#
# statuses
#
self.status_new = generate_oas_component(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da81560-c7fc-476a-ad13-beu760sle929",
zaak=self.zaak["url"],
statustype=f"{CATALOGI_ROOT}statustypen/e3798107-ab27-4c3c-977d-777yu878km09",
datumStatusGezet="2021-01-12",
statustoelichting="",
)
self.status_finish = generate_oas_component(
"zrc",
"schemas/Status",
Expand All @@ -131,14 +143,32 @@ def setUp(self) -> None:
datumStatusGezet="2021-03-12",
statustoelichting="",
)
#
# status types
#
self.status_type_new = generate_oas_component(
"ztc",
"schemas/StatusType",
url=self.status_new["statustype"],
zaaktype=self.zaaktype["url"],
catalogus=f"{CATALOGI_ROOT}catalogussen/1b643db-81bb-d71bd5a2317a",
omschrijving="Initial request",
omschrijvingGeneriek="Nieuw",
statustekst="",
volgnummer=1,
isEindstatus=False,
)
self.status_type_finish = generate_oas_component(
"ztc",
"schemas/StatusType",
url=self.status_finish["statustype"],
zaaktype=self.zaaktype["url"],
catalogus=f"{CATALOGI_ROOT}catalogussen/1b643db-81bb-d71bd5a2317a",
omschrijving="Finish",
omschrijvingGeneriek="some content",
omschrijvingGeneriek="Afgehandeld",
statustekst="",
volgnummer=1,
isEindstatus=True,
)
self.user_role = generate_oas_component(
"zrc",
Expand Down Expand Up @@ -285,6 +315,12 @@ def _setUpMocks(self, m):
]:
self.matchers.append(m.get(resource["url"], json=resource))

# mock `fetch_status_types_no_cache`
m.get(
f"{CATALOGI_ROOT}statustypen?zaaktype={self.zaak['zaaktype']}",
json=paginated_response([self.status_type_new, self.status_type_finish]),
)

self.matchers += [
m.get(
f"{ZAKEN_ROOT}zaken?rol__betrokkeneIdentificatie__natuurlijkPersoon__inpBsn={self.user.bsn}&maximaleVertrouwelijkheidaanduiding=beperkt_openbaar",
Expand Down
48 changes: 48 additions & 0 deletions src/open_inwoner/openzaak/migrations/0027_auto_20231101_1641.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Generated by Django 3.2.20 on 2023-11-01 15:41

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("openzaak", "0026_zaaktypestatustypeconfig_document_upload_description"),
]

operations = [
migrations.AlterField(
model_name="openzaakconfig",
name="title_text",
field=models.TextField(
default="Hier vindt u een overzicht van al uw lopende en afgeronde aanvragen.",
help_text="The title/introductory text shown on the list view of 'Mijn aanvragen'.",
verbose_name="Title text",
),
),
migrations.AlterField(
model_name="zaaktypestatustypeconfig",
name="status_indicator",
field=models.CharField(
blank=True,
choices=[
("info", "Info"),
("warning", "Warning"),
("failure", "Failure"),
("success", "Success"),
],
help_text="Determines what color will be shown to the user if a case is set to this status",
max_length=32,
verbose_name="Statustype indicator",
),
),
migrations.AlterField(
model_name="zaaktypestatustypeconfig",
name="status_indicator_text",
field=models.TextField(
blank=True,
default="",
help_text="Determines the text that will be shown to the user if a case is set to this status",
verbose_name="Statustype indicator text",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Generated by Django 3.2.20 on 2023-10-26 10:05

import django.db.models.deletion
from django.db import migrations, models

import django_better_admin_arrayfield.models.fields


class Migration(migrations.Migration):

dependencies = [
("openzaak", "0026_zaaktypestatustypeconfig_document_upload_description"),
]

operations = [
migrations.CreateModel(
name="ZaakTypeResultaatTypeConfig",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"resultaattype_url",
models.URLField(max_length=1000, verbose_name="Resultaattype URL"),
),
(
"omschrijving",
models.CharField(max_length=20, verbose_name="Omschrijving"),
),
(
"zaaktype_uuids",
django_better_admin_arrayfield.models.fields.ArrayField(
base_field=models.UUIDField(verbose_name="Zaaktype UUID"),
default=list,
size=None,
),
),
(
"description",
models.TextField(
blank=True,
default="",
help_text="Determines the text that will be shown to the user if a case is set to this result",
verbose_name="Frontend description",
),
),
(
"zaaktype_config",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="openzaak.zaaktypeconfig",
),
),
],
options={
"verbose_name": "Zaaktype Resultaattype Configuration",
},
),
migrations.AddConstraint(
model_name="zaaktyperesultaattypeconfig",
constraint=models.UniqueConstraint(
fields=("zaaktype_config", "resultaattype_url"),
name="unique_zaaktype_config_resultaattype_url",
),
),
]
13 changes: 13 additions & 0 deletions src/open_inwoner/openzaak/migrations/0028_merge_20231101_1705.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.20 on 2023-11-01 16:05

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("openzaak", "0027_auto_20231101_1641"),
("openzaak", "0027_zaaktype_resultaattype_config"),
]

operations = []

0 comments on commit b30845d

Please sign in to comment.