Skip to content

Commit

Permalink
Add test for organization actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MizukiTemma committed Nov 28, 2024
1 parent f9f7ce2 commit 3c0e0a4
Show file tree
Hide file tree
Showing 6 changed files with 619 additions and 54 deletions.
14 changes: 14 additions & 0 deletions integreat_cms/cms/fixtures/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,20 @@
"archived": true
}
},
{
"model": "cms.organization",
"pk": 3,
"fields": {
"name": "Not Referenced Organisation",
"slug": "not-referenced-organisation",
"icon": 1,
"last_updated": "2024-08-08T07:57:42.456Z",
"region": 1,
"created_date": "2024-08-08T07:57:42.456Z",
"website": "https://integreat-app.de/",
"archived": false
}
},
{
"model": "cms.poi",
"pk": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def delete(
messages.success(request, _("Organization was successfully deleted"))
else:
logger.info("%r couldn't be deleted by %r", organization, request.user)
messages.success(
messages.error(
request,
_("Organization couldn't be deleted as it's used by a page, poi or user"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
messages.success(
request,
ngettext_lazy(
"{model_name} {object_names} was succesfully archived.",
"The following {model_name_plural} were succesfully archived: {object_names}.",
"{model_name} {object_names} was successfully archived.",
"The following {model_name_plural} were successfully archived: {object_names}.",
len(archive_successful),
).format(
model_name=self.model._meta.verbose_name.title(),
Expand Down Expand Up @@ -107,8 +107,8 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
messages.success(
request,
ngettext_lazy(
"{model_name} {object_names} was succesfully restored.",
"The following {model_name_plural} were succesfully retsored: {object_names}.",
"{model_name} {object_names} was successfully restored.",
"The following {model_name_plural} were successfully restored: {object_names}.",
len(restore_successful),
).format(
model_name=self.model._meta.verbose_name.title(),
Expand Down Expand Up @@ -154,8 +154,8 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
messages.success(
request,
ngettext_lazy(
"{model_name} {object_names} was succesfully deleted.",
"The following {model_name_plural} were succesfully deleted: {object_names}.",
"{model_name} {object_names} was successfully deleted.",
"The following {model_name_plural} were successfully deleted: {object_names}.",
len(delete_successful),
).format(
model_name=self.model._meta.verbose_name.title(),
Expand Down
32 changes: 3 additions & 29 deletions integreat_cms/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -9026,6 +9026,7 @@ msgid "The selected {} were successfully {}"
msgstr "Die ausgewählten {} wurden erfolgreich {}"

#: cms/views/bulk_action_views.py cms/views/contacts/contact_bulk_actions.py
#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid "{model_name} {object_names} was successfully archived."
msgid_plural ""
Expand Down Expand Up @@ -9075,6 +9076,7 @@ msgstr[1] ""
"Veranstaltung oder einem Kontakt verwendet werden: \"{object_names}\""

#: cms/views/bulk_action_views.py cms/views/contacts/contact_bulk_actions.py
#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid "{model_name} {object_names} was successfully restored."
msgid_plural ""
Expand Down Expand Up @@ -9127,6 +9129,7 @@ msgid "Contact {0} was successfully copied"
msgstr "Kontakt {0} wurde erfolgreich kopiert"

#: cms/views/contacts/contact_bulk_actions.py
#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid "{model_name} {object_names} was successfully deleted."
msgid_plural ""
Expand Down Expand Up @@ -9841,16 +9844,6 @@ msgstr ""
"Die Organisation konnte nicht gelöscht werden, da sie von einer Seite, einem "
"Ort oder eines Users verwendet wird"

#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid "{model_name} {object_names} was succesfully archived."
msgid_plural ""
"The following {model_name_plural} were succesfully archived: {object_names}."
msgstr[0] "{model_name} {object_names} wurde erfolgreich archiviert."
msgstr[1] ""
"Die folgenden {model_name_plural} wurden erfolgreich archiviert: "
"{object_names}"

#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid ""
Expand All @@ -9866,25 +9859,6 @@ msgstr[1] ""
"Die folgenden {model_name_plural} konnten nicht archiviert werden, da sie "
"von einer Seite, einem Ort oder eines Users verwendet werden: {object_names}"

#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid "{model_name} {object_names} was succesfully restored."
msgid_plural ""
"The following {model_name_plural} were succesfully retsored: {object_names}."
msgstr[0] "{model_name} {object_names} wurde erfolgreich wiederhergestellt."
msgstr[1] ""
"Die folgenden {model_name_plural} wurden erfolgreich wiederhergestellt: "
"{object_names}"

#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid "{model_name} {object_names} was succesfully deleted."
msgid_plural ""
"The following {model_name_plural} were succesfully deleted: {object_names}."
msgstr[0] "{model_name} {object_names} wurde erfolgreich gelöscht."
msgstr[1] ""
"Die folgenden {model_name_plural} wurden erfolgreich gelöscht: {object_names}"

#: cms/views/organizations/organization_bulk_actions.py
#, python-brace-format
msgid ""
Expand Down
Loading

0 comments on commit 3c0e0a4

Please sign in to comment.