summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-24 17:09:12 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-24 17:09:12 +0100
commitffdafa9008dac20b2c4591321e444bd3cfc85c8f (patch)
treea02c23d421e629f59d1930c49358ba2c8249d399 /tests
parent3da3c3adee07256edf72d591a76f29a6b9d07f6b (diff)
downloadpykolab-ffdafa9008dac20b2c4591321e444bd3cfc85c8f.tar.gz
Provide purge_users and synchronize short cut calls
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/purge_users.py37
-rw-r--r--tests/functional/synchronize.py6
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/functional/purge_users.py b/tests/functional/purge_users.py
new file mode 100644
index 0000000..1b18cb0
--- /dev/null
+++ b/tests/functional/purge_users.py
@@ -0,0 +1,37 @@
+import pykolab
+
+from pykolab import wap_client
+from pykolab.auth import Auth
+from pykolab.imap import IMAP
+
+conf = pykolab.getConf()
+
+def purge_users():
+ wap_client.authenticate(conf.get("ldap", "bind_dn"), conf.get("ldap", "bind_pw"))
+
+ users = wap_client.users_list()
+ for user in users['list']:
+ wap_client.user_delete({'user': user})
+
+ auth = Auth()
+ domains = auth.list_domains()
+
+ imap = IMAP()
+ imap.connect()
+
+ folders = []
+
+ for domain,aliases in domains:
+ folders.extend(imap.lm("user/%%@%s" % (domain)))
+
+ for folder in folders:
+ user = folder.replace('user/','')
+
+ recipient = auth.find_recipient(user)
+
+ if len(recipient) == 0 or recipient == []:
+ try:
+ imap.dm(folder)
+ except:
+ pass
+
diff --git a/tests/functional/synchronize.py b/tests/functional/synchronize.py
new file mode 100644
index 0000000..7046db2
--- /dev/null
+++ b/tests/functional/synchronize.py
@@ -0,0 +1,6 @@
+from pykolab.auth import Auth
+
+def synchronize_once():
+ auth = Auth()
+ auth.connect()
+ auth.synchronize(mode='_paged_search')