Exemple #1
0
    def test_get_active_locales(self, meta_mock):
        assert fluent.get_active_locales("the/dude") == settings.DEV_LANGUAGES
        meta_mock.assert_not_called()

        meta_mock.return_value = {
            "active_locales": ["de", "fr", "it"],
            "inactive_locales": ["it", "sq"],
        }
        assert fluent.get_active_locales("the/dude", force=True) == ["de", "en-US", "fr"]
Exemple #2
0
    def test_get_active_locales(self, meta_mock):
        assert fluent.get_active_locales('the/dude') == settings.DEV_LANGUAGES
        meta_mock.assert_not_called()

        meta_mock.return_value = {
            'active_locales': ['de', 'fr', 'it'],
            'inactive_locales': ['it', 'sq'],
        }
        assert fluent.get_active_locales('the/dude', force=True) == ['de', 'en-US', 'fr']
    def print_report(self):
        active_locales = get_active_locales(self.filename, force=True)
        num_locales = len(active_locales)
        if num_locales == 1:
            self.stdout.write(f'There is 1 active locale for {self.filename}:')
        else:
            self.stdout.write(f'There are {num_locales} active locales for {self.filename}:')

        for locale in active_locales:
            self.stdout.write(f'- {locale}')
Exemple #4
0
 def test_get_active_locales_multiple_files(self, meta_mock):
     meta_mock.side_effect = [
         {"active_locales": ["de", "fr", "it"]},
         {"active_locales": ["en-CA", "pt-BR", "it"]},
     ]
     assert fluent.get_active_locales(["the/dude", "the/walter"]) == [
         "de",
         "en-CA",
         "en-US",
         "fr",
         "it",
         "pt-BR",
     ]
Exemple #5
0
 def test_get_active_locales_multiple_files(self, meta_mock):
     meta_mock.side_effect = [
         {'active_locales': ['de', 'fr', 'it']},
         {'active_locales': ['en-CA', 'pt-BR', 'it']},
     ]
     assert fluent.get_active_locales(['the/dude', 'the/walter']) == [
         'de',
         'en-CA',
         'en-US',
         'fr',
         'it',
         'pt-BR',
     ]