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-07-20 09:20:19 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-20 09:20:19 +0200
commita91c6f384436c910e7f98dfbec5765026fe4e0c5 (patch)
tree99dad86dbc2acd480c6c8f621cd8904863eb1a48 /tests/functional/test_wap_client/test_002_user_add.py
parent30ea265c66630f7961aa957ea8448086977f7a4f (diff)
downloadpykolab-a91c6f384436c910e7f98dfbec5765026fe4e0c5.tar.gz
Add some functional tests, move unit tests to separate directory
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.py57
1 files changed, 5 insertions, 52 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 55d030d..84eeeb2 100644
--- a/tests/functional/test_wap_client/test_002_user_add.py
+++ b/tests/functional/test_wap_client/test_002_user_add.py
@@ -16,62 +16,15 @@ class TestUserAdd(unittest.TestCase):
self.password = conf.get('ldap', 'bind_pw')
self.domain = conf.get('kolab', 'primary_domain')
- self.user_details = {
- 'givenname': "John",
- 'sn': "Doe",
- 'preferredlanguage': 'en_US',
- 'ou': 'ou=People,dc=example,dc=org',
- 'userpassword': 'Welcome2KolabSystems'
- }
-
self.user = {
'local': 'john.doe',
'domain': 'example.org'
}
- def test_001_user_add(self):
- user_type_id = 0
-
- result = wap_client.authenticate(self.login, self.password, self.domain)
-
- user_types = wap_client.user_types_list()
-
- for key in user_types['list'].keys():
- if user_types['list'][key]['key'] == 'kolab':
- user_type_id = key
-
- self.assertTrue(user_type_id > 0, "No 'kolab' user type found")
-
- user_type_info = user_types['list'][user_type_id]['attributes']
-
- params = {
- 'user_type_id': user_type_id,
- }
-
- for attribute in user_type_info['form_fields'].keys():
- attr_details = user_type_info['form_fields'][attribute]
-
- if isinstance(attr_details, dict):
- if not attr_details.has_key('optional') or attr_details['optional'] == False:
- self.assertTrue(self.user_details.has_key(attribute), "No attribute %r in user details" % (attribute))
- params[attribute] = self.user_details[attribute]
- elif isinstance(attr_details, list):
- self.assertTrue(self.user_details.has_key(attribute), "No attribute %r in user details" % (attribute))
- params[attribute] = self.user_details[attribute]
-
- fvg_params = params
- fvg_params['object_type'] = 'user'
- fvg_params['type_id'] = user_type_id
- fvg_params['attributes'] = [attr for attr in user_type_info['auto_form_fields'].keys() if not attr in params.keys()]
-
- exec("retval = wap_client.form_value_generate(%r)" % (params))
-
- for attribute in user_type_info['auto_form_fields'].keys():
- params[attribute] = retval[attribute]
-
- result = wap_client.user_add(params)
+ from tests.functional.user_add import user_add
+ user_add("John", "Doe")
- def test_003_inbox_created(self):
+ def test_001_inbox_created(self):
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -79,7 +32,7 @@ class TestUserAdd(unittest.TestCase):
folders = imap.lm('user/%(local)s@%(domain)s' % (self.user))
self.assertEqual(len(folders), 1)
- def test_004_autocreate_folders_created(self):
+ def test_002_autocreate_folders_created(self):
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -93,7 +46,7 @@ class TestUserAdd(unittest.TestCase):
self.assertEqual(len(folders), len(ac_folders.keys()))
- def test_005_folder_types_set(self):
+ def test_003_folder_types_set(self):
imap = IMAP()
imap.connect()