Skip to content

Commit

Permalink
Test that choices are properly passed to filter fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonatan-lopes committed Sep 24, 2023
1 parent fb5c260 commit dcf744e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions wagtail_localize/tests/test_translations_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,28 @@ def test_filter_by_target_locale_all_options(self):
self.assertIn(self.de_homepage_translation, response.context["object_list"])
self.assertIn(self.blog_index_translation, response.context["object_list"])
self.assertIn(self.blog_post_translation, response.context["object_list"])

def test_locale_filters_get_proper_choices(self):
response = self.client.get(reverse("wagtail_localize:translations_report"))

self.assertEqual(
list(response.context["filters"].form.fields["source_locale"].choices),
[
("all", "All"),
("en", "English"),
("fr", "French"),
("de", "German"),
("es", "Spanish"),
],
)

self.assertEqual(
list(response.context["filters"].form.fields["target_locale"].choices),
[
("all", "All"),
("en", "English"),
("fr", "French"),
("de", "German"),
("es", "Spanish"),
],
)

0 comments on commit dcf744e

Please sign in to comment.