test_locales.py 1.19 KB
Newer Older
Hiro's avatar
Hiro committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
import pytest
from twisted.trial import unittest
from twisted.internet import defer, reactor
from twisted.internet import task

from . import conftests

class EmailServiceTests(unittest.TestCase):

    # Fail any tests which take longer than 15 seconds.
    timeout = 15
    def setUp(self):
        self.settings = conftests.options.parse_settings()
        self.locales = conftests.strings.get_locales()


    def tearDown(self):
        print("tearDown()")

    def test_load_en_strings(self):
        conftests.strings.load_strings("en")
        self.assertEqual(conftests.strings._("smtp_mirrors_subject"), "[GetTor] Mirrors")

Hiro's avatar
Hiro committed
25
26
27
28
    def test_load_default_strings(self):
        conftests.strings.load_strings(None)
        self.assertEqual(conftests.strings._("smtp_mirrors_subject"), "[GetTor] Mirrors")

Hiro's avatar
Hiro committed
29
30
31
32
    def test_load_es_strings(self):
        conftests.strings.load_strings("es")
        self.assertEqual(conftests.strings._("smtp_help_subject"), "[GetTor] Ayuda")

33
34
35
36
    def test_locale_supported(self):
        self.assertEqual(self.locales['en']['language'], "English")
        self.assertEqual(self.locales['es']['locale'], "es-ES")

Hiro's avatar
Hiro committed
37
38
if __name__ == "__main__":
    unittest.main()