diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /python/compare-locales/compare_locales/tests/test_webapps.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'python/compare-locales/compare_locales/tests/test_webapps.py')
-rw-r--r-- | python/compare-locales/compare_locales/tests/test_webapps.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/python/compare-locales/compare_locales/tests/test_webapps.py b/python/compare-locales/compare_locales/tests/test_webapps.py new file mode 100644 index 000000000..2f1223649 --- /dev/null +++ b/python/compare-locales/compare_locales/tests/test_webapps.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import unittest + +from compare_locales import webapps + + +class TestFileComparison(unittest.TestCase): + + def mock_FileComparison(self, mock_listdir): + class Target(webapps.FileComparison): + def _listdir(self): + return mock_listdir() + return Target('.', 'en-US') + + def test_just_reference(self): + def _listdir(): + return ['my_app.en-US.properties'] + filecomp = self.mock_FileComparison(_listdir) + filecomp.files() + self.assertEqual(filecomp.locales(), []) + self.assertEqual(filecomp._reference.keys(), ['my_app']) + file_ = filecomp._reference['my_app'] + self.assertEqual(file_.file, 'locales/my_app.en-US.properties') + + def test_just_locales(self): + def _listdir(): + return ['my_app.ar.properties', + 'my_app.sr-Latn.properties', + 'my_app.sv-SE.properties', + 'my_app.po_SI.properties'] + filecomp = self.mock_FileComparison(_listdir) + filecomp.files() + self.assertEqual(filecomp.locales(), + ['ar', 'sr-Latn', 'sv-SE']) + self.assertEqual(filecomp._files['ar'].keys(), ['my_app']) + file_ = filecomp._files['ar']['my_app'] + self.assertEqual(file_.file, 'locales/my_app.ar.properties') |