コード例 #1
0
ファイル: test_fluent.py プロジェクト: mozilla/bedrock
    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"]
コード例 #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']
コード例 #3
0
ファイル: active_locales.py プロジェクト: yogiyadav08/bedrock
    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}')
コード例 #4
0
ファイル: test_fluent.py プロジェクト: mozilla/bedrock
 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",
     ]
コード例 #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',
     ]