|
4 | 4 | from django.core.management import call_command
|
5 | 5 | from django.test import TestCase
|
6 | 6 | from django.urls import NoReverseMatch, get_resolver
|
| 7 | +from django.utils.translation import activate, gettext as _ |
7 | 8 | from django_hosts.resolvers import reverse
|
8 | 9 |
|
9 | 10 | from docs.models import DocumentRelease, Release
|
10 | 11 |
|
11 | 12 |
|
| 13 | +class LocaleSmokeTests(TestCase): |
| 14 | + """ |
| 15 | + Smoke test a translated string from each of the 3 locale directories |
| 16 | + (one defined in settings.LOCALE_PATHS, plus the dashboard and docs apps). |
| 17 | + """ |
| 18 | + |
| 19 | + def test_dashboard_locale(self): |
| 20 | + """dashboard/locale/ should contain translations for 'Development dashboard'""" |
| 21 | + activate("fr") |
| 22 | + translated = _("Development dashboard") |
| 23 | + self.assertEqual( |
| 24 | + translated, |
| 25 | + "Tableau de bord de développement", |
| 26 | + msg="dashboard/locale/ translation not loaded or incorrect", |
| 27 | + ) |
| 28 | + |
| 29 | + def test_docs_locale(self): |
| 30 | + """docs/locale/ should contain translations for 'Using Django'""" |
| 31 | + activate("fr") |
| 32 | + translated = _("Using Django") |
| 33 | + self.assertEqual( |
| 34 | + translated, |
| 35 | + "Utilisation de Django", |
| 36 | + msg="docs/locale/ translation not loaded or incorrect", |
| 37 | + ) |
| 38 | + |
| 39 | + def test_project_locale(self): |
| 40 | + """locale/ should contain translations for 'Fundraising'""" |
| 41 | + activate("fr") |
| 42 | + translated = _("Fundraising") |
| 43 | + self.assertEqual( |
| 44 | + translated, |
| 45 | + "Levée de fonds", |
| 46 | + msg="project-level locale/ translation not loaded or incorrect", |
| 47 | + ) |
| 48 | + |
| 49 | + |
12 | 50 | class TemplateViewTests(TestCase):
|
13 | 51 | """
|
14 | 52 | Tests for views that are instances of TemplateView.
|
|
0 commit comments