summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 16:26:13 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-26 16:26:13 +0100
commit5450ee2039d3af5bfaa2d3734dfe7800e5b1aa24 (patch)
tree940ef14ba614f94751aae44ce2ea1093dd3a1f32 /tests
parentb11ef43b54a16e731d5e4ea7e546e1a17cac5665 (diff)
downloadpykolab-5450ee2039d3af5bfaa2d3734dfe7800e5b1aa24.tar.gz
Update test to run with and without a Kolab daemon running (or picking things up in the expected timeframe)
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/purge_imap.py5
-rw-r--r--tests/functional/test_kolabd/test_002_user_rename.py26
2 files changed, 27 insertions, 4 deletions
diff --git a/tests/functional/purge_imap.py b/tests/functional/purge_imap.py
index d3827a4..67d4aec 100644
--- a/tests/functional/purge_imap.py
+++ b/tests/functional/purge_imap.py
@@ -1,3 +1,5 @@
+import time
+
import pykolab
from pykolab import wap_client
@@ -6,8 +8,11 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
def purge_imap():
+ time.sleep(2)
+
imap = IMAP()
imap.connect()
+
for folder in imap.lm():
try:
imap.dm(folder)
diff --git a/tests/functional/test_kolabd/test_002_user_rename.py b/tests/functional/test_kolabd/test_002_user_rename.py
index dff9256..f526ade 100644
--- a/tests/functional/test_kolabd/test_002_user_rename.py
+++ b/tests/functional/test_kolabd/test_002_user_rename.py
@@ -21,7 +21,7 @@ class TestKolabDaemon(unittest.TestCase):
from tests.functional.user_add import user_add
user_add("John", "Doe")
- time.sleep(5)
+ time.sleep(2)
@classmethod
def teardown_class(self, *args, **kw):
@@ -34,6 +34,15 @@ class TestKolabDaemon(unittest.TestCase):
policy is applied, and the IMAP INBOX folder for the user is
renamed.
"""
+ auth = Auth()
+ auth.connect()
+ recipient = auth.find_recipient('john.doe@example.org')
+ user_info = wap_client.user_info(recipient)
+
+ if not user_info.has_key('mailhost'):
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+
imap = IMAP()
imap.connect()
folders = imap.lm('user/john.doe@example.org')
@@ -49,14 +58,23 @@ class TestKolabDaemon(unittest.TestCase):
user_info['uid'] = 'sixpack'
user_edit = wap_client.user_edit(recipient, user_info)
- time.sleep(5)
+ time.sleep(2)
+
+ print imap.lm()
user_info = wap_client.user_info('uid=sixpack,ou=People,dc=example,dc=org')
+ if not user_info['mail'] == 'joe.sixpack@example.org':
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+ user_info = wap_client.user_info('uid=sixpack,ou=People,dc=example,dc=org')
+
self.assertEqual(user_info['mail'], 'joe.sixpack@example.org')
+ print imap.lm()
+
folders = imap.lm('user/john.doe@example.org')
- self.assertEqual(len(folders), 0)
+ self.assertEqual(len(folders), 0, "INBOX for john.doe still exists")
folders = imap.lm('user/joe.sixpack@example.org')
- self.assertEqual(len(folders), 1)
+ self.assertEqual(len(folders), 1, "INBOX for joe.sixpack does not exist")