summaryrefslogtreecommitdiffstats
path: root/tests/functional/test_wap_client/test_002_user_add.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-24 17:15:48 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-24 17:15:48 +0100
commite2fe4e32e8864cde22c4e38adb5cd1058aca2f89 (patch)
treed796c70327f834a8c45cde35fbb2f5be222f12d9 /tests/functional/test_wap_client/test_002_user_add.py
parent75a9dfa0bd9a892fb89c04b7affa8a0e4b318f96 (diff)
downloadpykolab-e2fe4e32e8864cde22c4e38adb5cd1058aca2f89.tar.gz
Write and rebase a couple more tests
Diffstat (limited to 'tests/functional/test_wap_client/test_002_user_add.py')
-rw-r--r--tests/functional/test_wap_client/test_002_user_add.py59
1 files changed, 19 insertions, 40 deletions
diff --git a/tests/functional/test_wap_client/test_002_user_add.py b/tests/functional/test_wap_client/test_002_user_add.py
index 84eeeb2..96c3de1 100644
--- a/tests/functional/test_wap_client/test_002_user_add.py
+++ b/tests/functional/test_wap_client/test_002_user_add.py
@@ -3,18 +3,17 @@ import unittest
import pykolab
from pykolab import wap_client
+from pykolab.auth import Auth
from pykolab.imap import IMAP
conf = pykolab.getConf()
class TestUserAdd(unittest.TestCase):
+
@classmethod
def setup_class(self, *args, **kw):
- conf.finalize_conf(fatal=False)
-
- self.login = conf.get('ldap', 'bind_dn')
- self.password = conf.get('ldap', 'bind_pw')
- self.domain = conf.get('kolab', 'primary_domain')
+ from tests.functional.purge_users import purge_users
+ purge_users()
self.user = {
'local': 'john.doe',
@@ -23,8 +22,16 @@ class TestUserAdd(unittest.TestCase):
from tests.functional.user_add import user_add
user_add("John", "Doe")
+ 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()
@@ -46,7 +53,7 @@ class TestUserAdd(unittest.TestCase):
self.assertEqual(len(folders), len(ac_folders.keys()))
- def test_003_folder_types_set(self):
+ def test_003_folders_metadata_set(self):
imap = IMAP()
imap.connect()
@@ -57,45 +64,17 @@ class TestUserAdd(unittest.TestCase):
folders.extend(imap.lm('user/%(local)s/*@%(domain)s' % (self.user)))
for folder in folders:
- annotation = imap.getannotation(folder)
- print annotation
+ metadata = imap.get_metadata(folder)
folder_name = '/'.join(folder.split('/')[2:]).split('@')[0]
if ac_folders.has_key(folder_name):
if ac_folders[folder_name].has_key('annotations'):
for _annotation in ac_folders[folder_name]['annotations'].keys():
- _annotation_value = ac_folders[folder_name]['annotations'][_annotation]
- self.assertTrue(annotation[annotation.keys().pop()].has_key(_annotation))
- self.assertEqual(_annotation_value, annotation[annotation.keys().pop()][_annotation])
-
- @classmethod
- def teardown_class(self):
- time.sleep(2)
-
- res_attr = conf.get('cyrus-sasl', 'result_attribute')
+ if _annotation.startswith('/private/'):
+ continue
- exec("ac_folders = %s" % (conf.get_raw(conf.get('kolab', 'primary_domain'), 'autocreate_folders')))
- expected_number_of_folders = len(ac_folders.keys()) + 1
-
- users = []
-
- result = wap_client.users_list()
- for user in result['list'].keys():
- user_info = wap_client.user_info(user)
- users.append(user_info)
- result = wap_client.user_delete({'user': user})
-
- imap = IMAP()
- imap.connect()
-
- for user in users:
- if len(user[res_attr].split('@')) > 1:
- localpart = user[res_attr].split('@')[0]
- domain = user[res_attr].split('@')[1]
-
- folders = []
- folders.extend(imap.lm('user/%s' % (user[res_attr])))
- folders.extend(imap.lm('user/%s/*@%s' % (localpart,domain)))
+ _annotation_value = ac_folders[folder_name]['annotations'][_annotation]
+ self.assertTrue(metadata[metadata.keys().pop()].has_key(_annotation))
+ self.assertEqual(_annotation_value, metadata[metadata.keys().pop()][_annotation])
- # Expect folders length to be 0