summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-07-05 13:25:13 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-07-05 13:25:13 +0100
commit78f17cb9d1213d4c1529b644d72f304bca6bc32a (patch)
tree25f13cbbe4b3007f534f7251504e22d85f428fa3 /pykolab
parentecc170674d3486b4589d29b71657157d1123424a (diff)
downloadpykolab-78f17cb9d1213d4c1529b644d72f304bca6bc32a.tar.gz
Avoid unknown keyword recoverable
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/tests/__init__.py2
-rw-r--r--pykolab/tests/contacts.py39
-rw-r--r--pykolab/tests/zpush/test_000_000.py40
3 files changed, 42 insertions, 39 deletions
diff --git a/pykolab/tests/__init__.py b/pykolab/tests/__init__.py
index fba8133..cee3674 100644
--- a/pykolab/tests/__init__.py
+++ b/pykolab/tests/__init__.py
@@ -80,4 +80,4 @@ class Tests(object):
exec("from pykolab.tests.%s import %sTest" %(suite,suite.capitalize()))
exec("%stest = %sTest()" %(suite,suite.capitalize()))
except ImportError, e:
- conf.log.error(_("Tests for suite %s failed to load. Aborting.") %(suite.capitalize()), recoverable=False)
+ conf.log.error(_("Tests for suite %s failed to load. Aborting.") %(suite.capitalize()))
diff --git a/pykolab/tests/contacts.py b/pykolab/tests/contacts.py
index 1d05dec..bc60bbd 100644
--- a/pykolab/tests/contacts.py
+++ b/pykolab/tests/contacts.py
@@ -19,15 +19,23 @@
import calendar
import datetime
+import imaplib
import os
import random
import time
-from pykolab.conf import Conf
+import pykolab
+
from pykolab.constants import *
from pykolab.tests.constants import *
from pykolab.translate import _
+log = pykolab.getLogger('pykolab.tests.contacts')
+
+conf = pykolab.getConf()
+
+imap = pykolab.imap
+
class ContactsItem(object):
def __init__(self, item_num=0, total_num=1, folder=None, user=None):
"""
@@ -66,7 +74,7 @@ class ContactsItem(object):
if folder:
self.mailbox = folder
else:
- self.mailbox = "INBOX/Contacts"
+ self.mailbox = "Contacts"
self.randomize_contact()
@@ -78,7 +86,7 @@ class ContactsItem(object):
pass
def __str__(self):
- for tpl_file_location in [ '/usr/share/kolab/tests/kaddress-contact.tpl', './share/tests/kaddress-contact.tpl' ]:
+ for tpl_file_location in [ '/usr/share/kolab/tests/kaddress-contact.tpl', './share/tests/kaddress-contact.tpl', '../share/tests/kaddress-contact.tpl' ]:
if os.path.isfile(tpl_file_location):
tpl_file = open(tpl_file_location, 'r')
tpl_orig = tpl_file.read()
@@ -94,23 +102,18 @@ def create_items(conf, num=None, folder=None):
if num:
info['number'] = int(num)
- conf.log.debug(_("Creating %d Contacts") %(info['number']), level=3)
+ log.debug(_("Creating %d Contacts") %(info['number']), level=3)
alloc_uids = []
- imap = True
-
- for user in conf.testing_users:
+ for user in eval(conf.get('testing','users')):
if conf.use_mail:
pass
elif conf.use_lmtp:
pass
elif conf.use_imap:
- import imaplib
- if imap:
- del imap
- imap = imaplib.IMAP4(conf.testing_server)
- imap.login("%(givenname)s@%(domain)s" %(user), user['password'])
+ imap.connect(login=False)
+ imap.login("%(givenname)s.%(sn)s@%(domain)s" %(user), user['password'])
else:
pass
@@ -118,7 +121,7 @@ def create_items(conf, num=None, folder=None):
item_num = 0
while item_num < int(info['number']):
- conf.log.debug(_("Creating Contact item number %d") %(item_num+1), level=5)
+ log.debug(_("Creating Contact item number %d") %(item_num+1), level=5)
item = ContactsItem(item_num=(item_num+1), total_num=num, folder=folder, user=user)
@@ -130,15 +133,15 @@ def create_items(conf, num=None, folder=None):
msg = str(item)
if conf.use_mail:
- conf.log.debug(_("Sending UID message %s through SMTP targeting user %s@%s") %(item.uid,user['givenname'],user['domain']), level=9)
+ log.debug(_("Sending UID message %s through SMTP targeting user %s@%s") %(item.uid,user['givenname'],user['domain']), level=9)
elif conf.use_lmtp:
- conf.log.debug(_("Sending UID message %s through LMTP targeting user %s@%s") %(item.uid,user['givenname'],user['domain']), level=9)
+ log.debug(_("Sending UID message %s through LMTP targeting user %s@%s") %(item.uid,user['givenname'],user['domain']), level=9)
elif conf.use_imap:
- conf.log.debug(_("Saving UID message %s to IMAP (user %s, folder %s)") %(item.uid,user['givenname'],item.mailbox), level=9)
- imap.append(item.mailbox, '', imaplib.Time2Internaldate(time.time()), msg)
+ log.debug(_("Saving UID message %s to IMAP (user %s, folder %s)") %(item.uid,user['givenname'],item.mailbox), level=9)
+ imap.imap.m.append(item.mailbox, '', imaplib.Time2Internaldate(time.time()), msg)
else:
- conf.log.debug(_("Somehow ended up NOT sending these messages"), level=9)
+ log.debug(_("Somehow ended up NOT sending these messages"), level=9)
item_num +=1
diff --git a/pykolab/tests/zpush/test_000_000.py b/pykolab/tests/zpush/test_000_000.py
index 415de0b..7cc2f62 100644
--- a/pykolab/tests/zpush/test_000_000.py
+++ b/pykolab/tests/zpush/test_000_000.py
@@ -32,7 +32,7 @@ class Test_000_000(object):
Preparations for the Test 000 series.
"""
- def __init__(self, conf=None):
+ def __init__(self):
self.suite_num = "000"
self.suite_test_num = "000"
@@ -47,23 +47,23 @@ class Test_000_000(object):
#for folder in imap.lm("user/%"):
#imap.dm(folder)
- for user in auth.list_users(domain):
- for mailbox in imap.lm("user%s%s" %(imap.SEP,"%(givenname)s@%(domain)s" %(user))):
- log.debug(_("Deleting mailbox: %s") %(mailbox), level=3)
- try:
- imap.dm(mailbox)
- except cyruslib.CYRUSError, e:
- pass
+ #for user in auth.list_users(domain):
+ #for mailbox in imap.lm("user%s%s" %(imap.SEP,"%(givenname)s@%(domain)s" %(user))):
+ #log.debug(_("Deleting mailbox: %s") %(mailbox), level=3)
+ #try:
+ #imap.dm(mailbox)
+ #except cyruslib.CYRUSError, e:
+ #pass
- # Recreate the user top-level mailboxes
- for user in conf.testing_users:
- mailbox = "user%s%s" %(imap.SEP,"%(givenname)s@%(domain)s" %(user))
- log.debug(_("Creating mailbox: %s") %(mailbox), level=3)
- imap.cm(mailbox)
+ ## Recreate the user top-level mailboxes
+ #for user in conf.testing_users:
+ #mailbox = "user%s%s" %(imap.SEP,"%(givenname)s@%(domain)s" %(user))
+ #log.debug(_("Creating mailbox: %s") %(mailbox), level=3)
+ #imap.cm(mailbox)
- imap.logout()
+ #imap.logout()
- del imap
+ #del imap
# Have the user themselves:
# - create the standard folders
@@ -72,9 +72,9 @@ class Test_000_000(object):
for user in conf.testing_users:
imap = cyruslib.CYRUS("imap://%s:143" %(conf.testing_server))
try:
- imap.login("%(givenname)s@%(domain)s" %(user), user['password'])
+ imap.login("%(givenname)s.%(surname)s@%(domain)s" %(user), user['password'])
except:
- log.error(_("Authentication failure for %s") %("%(givenname)s@%(domain)s" %(user)), recoverable=True)
+ log.error(_("Authentication failure for %s") %("%(givenname)s.%(surname)s@%(domain)s" %(user)))
continue
if conf.debuglevel > 3:
@@ -83,11 +83,11 @@ class Test_000_000(object):
imap.subscribe("INBOX")
for mailbox in TEST_FOLDERS.keys():
- imap.cm("INBOX/%s" %(mailbox))
+ imap.cm("%s" %(mailbox))
for annotation in TEST_FOLDERS[mailbox]['annotations'].keys():
- imap.setannotation("INBOX/%s" %(mailbox),annotation,TEST_FOLDERS[mailbox]['annotations'][annotation])
+ imap.setannotation("%s" %(mailbox),annotation,TEST_FOLDERS[mailbox]['annotations'][annotation])
- imap.subscribe("INBOX/%s" %(mailbox))
+ imap.subscribe("%s" %(mailbox))
imap.logout()
del imap \ No newline at end of file