summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-10 16:49:58 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-10 16:49:58 +0100
commit80e07eb905091c6bb921329cd883ae7c51647e0c (patch)
tree0de5df1e5b22248009a15c02df3ae895bb3d17a8 /tests
parentd024ba1a14d7ad833879ed9ff033729edf5ccd2c (diff)
downloadpykolab-80e07eb905091c6bb921329cd883ae7c51647e0c.tar.gz
Add tests for #1508
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_wap_client/test_003_user_add_fr_FR.py58
-rw-r--r--tests/functional/test_wap_client/test_004_user_add_es_ES.py58
-rw-r--r--tests/functional/test_wap_client/test_005_user_add_de_CH.py57
-rw-r--r--tests/unit/test-010-transliterate.py64
4 files changed, 237 insertions, 0 deletions
diff --git a/tests/functional/test_wap_client/test_003_user_add_fr_FR.py b/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
new file mode 100644
index 0000000..b9ef510
--- /dev/null
+++ b/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+import time
+import unittest
+
+import pykolab
+from pykolab import wap_client
+from pykolab.auth import Auth
+from pykolab.imap import IMAP
+
+conf = pykolab.getConf()
+
+class TestUserAddFrFR(unittest.TestCase):
+ @classmethod
+ def setup_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ self.user = {
+ 'local': 'etienne-nicolas.mehul',
+ 'domain': 'example.org'
+ }
+
+ from tests.functional.user_add import user_add
+ user_add("Étienne-Nicolas", "Méhul", 'fr_FR')
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+
+ @classmethod
+ def teardown_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ def test_001_inbox_created(self):
+
+ time.sleep(2)
+ imap = IMAP()
+ imap.connect()
+
+ folders = imap.lm('user/%(local)s@%(domain)s' % (self.user))
+ self.assertEqual(len(folders), 1)
+
+ def test_002_fr_FR_user_recipient_policy(self):
+ auth = Auth()
+ auth.connect()
+ recipient = auth.find_recipient("%(local)s@%(domain)s" % (self.user))
+ if hasattr(self, 'assertIsInstance'):
+ self.assertIsInstance(recipient, str)
+
+ self.assertEqual(recipient, "uid=mehul,ou=People,dc=example,dc=org")
+
+ result = wap_client.user_info(recipient)
+ print result
+
+ self.assertEqual(result['mail'], 'etienne-nicolas.mehul@example.org')
+ self.assertEqual(sorted(result['alias']), ['e.mehul@example.org', 'mehul@example.org'])
+
+
diff --git a/tests/functional/test_wap_client/test_004_user_add_es_ES.py b/tests/functional/test_wap_client/test_004_user_add_es_ES.py
new file mode 100644
index 0000000..a681a2d
--- /dev/null
+++ b/tests/functional/test_wap_client/test_004_user_add_es_ES.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+import time
+import unittest
+
+import pykolab
+from pykolab import wap_client
+from pykolab.auth import Auth
+from pykolab.imap import IMAP
+
+conf = pykolab.getConf()
+
+class TestUserAddEsES(unittest.TestCase):
+
+ @classmethod
+ def setup_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ self.user = {
+ 'local': 'alvaro.fuentes',
+ 'domain': 'example.org'
+ }
+
+ from tests.functional.user_add import user_add
+ user_add("Álvaro", "Fuentes", 'es_ES')
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+
+ @classmethod
+ def teardown_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ def test_001_inbox_created(self):
+
+ time.sleep(2)
+ imap = IMAP()
+ imap.connect()
+
+ folders = imap.lm('user/%(local)s@%(domain)s' % (self.user))
+ self.assertEqual(len(folders), 1)
+
+ def test_002_fr_FR_user_recipient_policy(self):
+ auth = Auth()
+ auth.connect()
+ recipient = auth.find_recipient("%(local)s@%(domain)s" % (self.user))
+ if hasattr(self, 'assertIsInstance'):
+ self.assertIsInstance(recipient, str)
+
+ self.assertEqual(recipient, "uid=fuentes,ou=People,dc=example,dc=org")
+
+ result = wap_client.user_info(recipient)
+
+ self.assertEqual(result['mail'], 'alvaro.fuentes@example.org')
+ self.assertEqual(sorted(result['alias']), ['a.fuentes@example.org', 'fuentes@example.org'])
+
+
diff --git a/tests/functional/test_wap_client/test_005_user_add_de_CH.py b/tests/functional/test_wap_client/test_005_user_add_de_CH.py
new file mode 100644
index 0000000..dd38383
--- /dev/null
+++ b/tests/functional/test_wap_client/test_005_user_add_de_CH.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import time
+import unittest
+
+import pykolab
+from pykolab import wap_client
+from pykolab.auth import Auth
+from pykolab.imap import IMAP
+
+conf = pykolab.getConf()
+
+class TestUserAddDeCH(unittest.TestCase):
+ @classmethod
+ def setup_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ self.user = {
+ 'local': 'thomas.bruederli',
+ 'domain': 'example.org'
+ }
+
+ from tests.functional.user_add import user_add
+ user_add("Thomas", "Brüderli", 'de_CH')
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+
+ @classmethod
+ def teardown_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ def test_001_inbox_created(self):
+
+ time.sleep(2)
+ imap = IMAP()
+ imap.connect()
+
+ folders = imap.lm('user/%(local)s@%(domain)s' % (self.user))
+ self.assertEqual(len(folders), 1)
+
+ def test_002_fr_FR_user_recipient_policy(self):
+ auth = Auth()
+ auth.connect()
+ recipient = auth.find_recipient("%(local)s@%(domain)s" % (self.user))
+ if hasattr(self, 'assertIsInstance'):
+ self.assertIsInstance(recipient, str)
+
+ self.assertEqual(recipient, "uid=bruederli,ou=People,dc=example,dc=org")
+
+ result = wap_client.user_info(recipient)
+
+ self.assertEqual(result['mail'], 'thomas.bruederli@example.org')
+ self.assertEqual(sorted(result['alias']), ['bruederli@example.org', 't.bruederli@example.org'])
+
+
diff --git a/tests/unit/test-010-transliterate.py b/tests/unit/test-010-transliterate.py
new file mode 100644
index 0000000..7f70700
--- /dev/null
+++ b/tests/unit/test-010-transliterate.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+
+class TestTransliteration(unittest.TestCase):
+ def test_001_raw_fr_FR(self):
+ """
+ The special thing about this case is that the givenname starts with
+ a special character.
+ """
+ from pykolab import utils
+ givenname = r'Étienne-Nicolas'
+ surname = r'Méhul'
+
+ preferredlanguage = 'fr_FR'
+
+ self.assertEqual('Etienne-Nicolas', utils.translate(givenname, preferredlanguage))
+ self.assertEqual('Mehul', utils.translate(surname, preferredlanguage))
+
+ def test_002_unicode_fr_FR(self):
+ """
+ The special thing about this case is that the givenname starts with
+ a special character.
+ """
+ from pykolab import utils
+ givenname = 'Étienne-Nicolas'
+ surname = 'Méhul'
+
+ preferredlanguage = 'fr_FR'
+
+ self.assertEqual('Etienne-Nicolas', utils.translate(givenname, preferredlanguage))
+ self.assertEqual('Mehul', utils.translate(surname, preferredlanguage))
+
+ def test_003_raw_es_ES(self):
+ """
+ The special thing about this case is that the givenname starts with
+ a special character.
+ """
+ from pykolab import utils
+ givenname = r'Álvaro'
+ surname = r'Fuentes'
+
+ preferredlanguage = 'es_ES'
+
+ self.assertEqual('Alvaro', utils.translate(givenname, preferredlanguage))
+ self.assertEqual('Fuentes', utils.translate(surname, preferredlanguage))
+
+ def test_004_unicode_es_ES(self):
+ """
+ The special thing about this case is that the givenname starts with
+ a special character.
+ """
+ from pykolab import utils
+ givenname = 'Álvaro'
+ surname = 'Fuentes'
+
+ preferredlanguage = 'es_ES'
+
+ self.assertEqual('Alvaro', utils.translate(givenname, preferredlanguage))
+ self.assertEqual('Fuentes', utils.translate(surname, preferredlanguage))
+
+
+if __name__ == '__main__':
+ unittest.main()