summaryrefslogtreecommitdiffstats
path: root/tests/functional/test_kolabd
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 15:06:11 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 15:06:11 +0100
commit02a5f7f9eb5e62a0e1498e151c6e9dd968aec6fd (patch)
tree7daa90a035534a7257d2f8f9e3067cd88f259c09 /tests/functional/test_kolabd
parent0d634bb139dcaf041ebe8192b2996e6725bd5c1c (diff)
downloadpykolab-02a5f7f9eb5e62a0e1498e151c6e9dd968aec6fd.tar.gz
Update tests for fixed web admin
Diffstat (limited to 'tests/functional/test_kolabd')
-rw-r--r--tests/functional/test_kolabd/test_001_user_sync.py27
-rw-r--r--tests/functional/test_kolabd/test_002_user_rename.py62
-rw-r--r--tests/functional/test_kolabd/test_003_two_johns.py51
3 files changed, 121 insertions, 19 deletions
diff --git a/tests/functional/test_kolabd/test_001_user_sync.py b/tests/functional/test_kolabd/test_001_user_sync.py
index e8e31bf..44858bb 100644
--- a/tests/functional/test_kolabd/test_001_user_sync.py
+++ b/tests/functional/test_kolabd/test_001_user_sync.py
@@ -36,15 +36,9 @@ class TestKolabDaemon(unittest.TestCase):
self.assertEqual(recipient, "uid=doe,ou=People,dc=example,dc=org")
- result_before = wap_client.user_info(recipient)
-
- # Ensure the synchronization is run even without a kolab daemon running.
- auth.synchronize(mode='_paged_search')
-
- result_after = wap_client.user_info(recipient)
- self.assertEqual(result_after['mail'], 'john.doe@example.org')
- self.assertEqual(result_before['alias'], ['doe@example.org', 'j.doe@example.org', 'john.doe@example.org'])
- self.assertEqual(result_after['alias'], ['doe@example.org', 'j.doe@example.org'])
+ result = wap_client.user_info(recipient)
+ self.assertEqual(result['mail'], 'john.doe@example.org')
+ self.assertEqual(result['alias'], ['doe@example.org', 'j.doe@example.org'])
def test_002_user_recipient_policy_duplicate(self):
from tests.functional.user_add import user_add
@@ -62,15 +56,10 @@ class TestKolabDaemon(unittest.TestCase):
self.assertEqual(recipient, "uid=doe2,ou=People,dc=example,dc=org")
- result_before = wap_client.user_info(recipient)
-
- # Ensure the synchronization is run even without a kolab daemon running.
- auth.synchronize(mode='_paged_search')
+ result = wap_client.user_info(recipient)
- result_after = wap_client.user_info(recipient)
- self.assertEqual(result_after['mail'], 'jane.doe@example.org')
- self.assertEqual(result_before['alias'], ['doe2@example.org', 'j.doe2@example.org', 'jane.doe@example.org'])
- self.assertEqual(result_after['alias'], ['doe2@example.org', 'j.doe2@example.org'])
+ self.assertEqual(result['mail'], 'jane.doe@example.org')
+ self.assertEqual(result['alias'], ['doe2@example.org', 'j.doe2@example.org'])
def test_003_user_mailbox_created(self):
time.sleep(2)
@@ -126,8 +115,8 @@ class TestKolabDaemon(unittest.TestCase):
folders = imap.lm()
self.assertTrue("INBOX" in folders)
- #folders = imap.imap.lsub()
- #self.assertTrue("Calendar" in folders)
+ folders = imap.imap.lsub()
+ self.assertTrue("Calendar" in folders)
def test_011_resource_add(self):
pass
diff --git a/tests/functional/test_kolabd/test_002_user_rename.py b/tests/functional/test_kolabd/test_002_user_rename.py
new file mode 100644
index 0000000..dff9256
--- /dev/null
+++ b/tests/functional/test_kolabd/test_002_user_rename.py
@@ -0,0 +1,62 @@
+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 TestKolabDaemon(unittest.TestCase):
+ @classmethod
+ def setup_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ self.user = {
+ 'local': 'john.doe',
+ 'domain': 'example.org'
+ }
+
+ from tests.functional.user_add import user_add
+ user_add("John", "Doe")
+ time.sleep(5)
+
+ @classmethod
+ def teardown_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ def test_001_user_rename(self):
+ """
+ Rename user "Doe, John" to "Sixpack, Joe" and verify the recipient
+ policy is applied, and the IMAP INBOX folder for the user is
+ renamed.
+ """
+ imap = IMAP()
+ imap.connect()
+ folders = imap.lm('user/john.doe@example.org')
+ self.assertEqual(len(folders), 1)
+
+ auth = Auth()
+ auth.connect()
+ recipient = auth.find_recipient("%(local)s@%(domain)s" % (self.user))
+
+ user_info = wap_client.user_info(recipient)
+ user_info['sn'] = 'Sixpack'
+ user_info['givenname'] = 'Joe'
+ user_info['uid'] = 'sixpack'
+ user_edit = wap_client.user_edit(recipient, user_info)
+
+ time.sleep(5)
+
+ user_info = wap_client.user_info('uid=sixpack,ou=People,dc=example,dc=org')
+ self.assertEqual(user_info['mail'], 'joe.sixpack@example.org')
+
+ folders = imap.lm('user/john.doe@example.org')
+ self.assertEqual(len(folders), 0)
+
+ folders = imap.lm('user/joe.sixpack@example.org')
+ self.assertEqual(len(folders), 1)
+
diff --git a/tests/functional/test_kolabd/test_003_two_johns.py b/tests/functional/test_kolabd/test_003_two_johns.py
new file mode 100644
index 0000000..b2bfb46
--- /dev/null
+++ b/tests/functional/test_kolabd/test_003_two_johns.py
@@ -0,0 +1,51 @@
+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 TestKolabDaemon(unittest.TestCase):
+ @classmethod
+ def setup_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ @classmethod
+ def teardown_class(self, *args, **kw):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ def test_001_two_johns(self):
+ from tests.functional.user_add import user_add
+ user_add("John", "Doe")
+ user_add("John", "Doe")
+
+ time.sleep(3)
+
+ auth = Auth()
+ auth.connect()
+
+ max_tries = 20
+ while max_tries > 0:
+ recipient1 = auth.find_recipient('john.doe@example.org')
+ recipient2 = auth.find_recipient('john.doe2@example.org')
+
+ if not recipient1 or not recipient2:
+ time.sleep(1)
+ max_tries -= 1
+ else:
+ break
+
+ imap = IMAP()
+ imap.connect()
+
+ folders = imap.lm('user/john.doe@example.org')
+ self.assertEqual(len(folders), 1, "No INBOX found for first John")
+
+ folders = imap.lm('user/john.doe2@example.org')
+ self.assertEqual(len(folders), 1, "No INBOX found for second John")
+