summaryrefslogtreecommitdiffstats
path: root/tests/functional
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-05-04 15:53:48 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-04 15:53:48 +0200
commitc204eaaa2c9a006432fe00489a352833143db01d (patch)
tree18860f2e335b9a98d34f404d5c4b81d22f2ce222 /tests/functional
parent4a24e0cc403321713ee1201ade9d36956da1c060 (diff)
downloadpykolab-c204eaaa2c9a006432fe00489a352833143db01d.tar.gz
CS fixes according to PEP8 (ignored mostly line-length errors only)
Summary: . Reviewers: #pykolab_developers Differential Revision: https://git.kolab.org/D134
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/purge_imap.py1
-rw-r--r--tests/functional/purge_users.py1
-rw-r--r--tests/functional/resource_func.py24
-rw-r--r--tests/functional/synchronize.py1
-rw-r--r--tests/functional/test_kolabd/__init__.py1
-rw-r--r--tests/functional/test_kolabd/test_001_user_sync.py10
-rw-r--r--tests/functional/test_kolabd/test_002_user_rename.py4
-rw-r--r--tests/functional/test_kolabd/test_003_two_johns.py2
-rw-r--r--tests/functional/test_postfix/__init__.py1
-rw-r--r--tests/functional/test_wallace/__init__.py1
-rw-r--r--tests/functional/test_wallace/test_001_user_add.py4
-rw-r--r--tests/functional/test_wallace/test_002_footer.py5
-rw-r--r--tests/functional/test_wallace/test_003_nonascii_subject.py8
-rw-r--r--tests/functional/test_wallace/test_004_nonascii_addresses.py8
-rw-r--r--tests/functional/test_wallace/test_005_resource_add.py11
-rw-r--r--tests/functional/test_wallace/test_005_resource_invitation.py243
-rw-r--r--tests/functional/test_wallace/test_006_resource_performance.py29
-rw-r--r--tests/functional/test_wallace/test_007_invitationpolicy.py172
-rw-r--r--tests/functional/test_wap_client/__init__.py1
-rw-r--r--tests/functional/test_wap_client/test_001_connect.py15
-rw-r--r--tests/functional/test_wap_client/test_002_user_add.py12
-rw-r--r--tests/functional/test_wap_client/test_003_user_add_fr_FR.py4
-rw-r--r--tests/functional/test_wap_client/test_004_user_add_es_ES.py4
-rw-r--r--tests/functional/test_wap_client/test_005_user_add_de_CH.py3
-rw-r--r--tests/functional/test_wap_client/test_006_form_value_select_options.py6
-rw-r--r--tests/functional/test_wap_client/test_007_policy_uid.py3
-rw-r--r--tests/functional/test_wap_client/test_008_resource_add.py3
-rw-r--r--tests/functional/user_add.py16
28 files changed, 277 insertions, 316 deletions
diff --git a/tests/functional/purge_imap.py b/tests/functional/purge_imap.py
index 67d4aec..f4d62e0 100644
--- a/tests/functional/purge_imap.py
+++ b/tests/functional/purge_imap.py
@@ -7,6 +7,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
def purge_imap():
time.sleep(2)
diff --git a/tests/functional/purge_users.py b/tests/functional/purge_users.py
index 17db9d7..713ea46 100644
--- a/tests/functional/purge_users.py
+++ b/tests/functional/purge_users.py
@@ -6,6 +6,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
def purge_users():
wap_client.authenticate(conf.get("ldap", "bind_dn"), conf.get("ldap", "bind_pw"))
diff --git a/tests/functional/resource_func.py b/tests/functional/resource_func.py
index a7e4d90..36bd1bd 100644
--- a/tests/functional/resource_func.py
+++ b/tests/functional/resource_func.py
@@ -4,11 +4,12 @@ from pykolab import wap_client
conf = pykolab.getConf()
+
def resource_add(type, cn, members=None, owner=None, **kw):
- if type == None or type == '':
+ if type is None or type == '':
raise Exception
- if cn == None or cn == '':
+ if cn is None or cn == '':
raise Exception
resource_details = {
@@ -21,7 +22,10 @@ def resource_add(type, cn, members=None, owner=None, **kw):
resource_details.update(kw)
- result = wap_client.authenticate(conf.get('ldap', 'bind_dn'), conf.get('ldap', 'bind_pw'), conf.get('kolab', 'primary_domain'))
+ bind_dn = conf.get('ldap', 'bind_dn')
+ bind_pw = conf.get('ldap', 'bind_pw')
+ domain = conf.get('kolab', 'primary_domain')
+ result = wap_client.authenticate(bind_dn, bind_pw, domain)
type_id = 0
resource_types = wap_client.resource_types_list()
@@ -41,7 +45,7 @@ def resource_add(type, cn, members=None, owner=None, **kw):
attr_details = resource_type_info['form_fields'][attribute]
if isinstance(attr_details, dict):
- if not attr_details.has_key('optional') or attr_details['optional'] == False or resource_details.has_key(attribute):
+ if 'optional' not in attr_details or attr_details['optional'] is False or attribute in resource_details:
params[attribute] = resource_details[attribute]
elif isinstance(attr_details, list):
params[attribute] = resource_details[attribute]
@@ -49,7 +53,7 @@ def resource_add(type, cn, members=None, owner=None, **kw):
fvg_params = params
fvg_params['object_type'] = 'resource'
fvg_params['type_id'] = type_id
- fvg_params['attributes'] = [attr for attr in resource_type_info['auto_form_fields'].keys() if not attr in params.keys()]
+ fvg_params['attributes'] = [attr for attr in resource_type_info['auto_form_fields'].keys() if attr not in params]
result = wap_client.resource_add(params)
result['dn'] = "cn=" + result['cn'] + ",ou=Resources,dc=example,dc=org"
@@ -57,13 +61,15 @@ def resource_add(type, cn, members=None, owner=None, **kw):
def purge_resources():
- wap_client.authenticate(conf.get("ldap", "bind_dn"), conf.get("ldap", "bind_pw"), conf.get('kolab', 'primary_domain'))
+ bind_dn = conf.get('ldap', 'bind_dn')
+ bind_pw = conf.get('ldap', 'bind_pw')
+ domain = conf.get('kolab', 'primary_domain')
+ result = wap_client.authenticate(bind_dn, bind_pw, domain)
resources = wap_client.resources_list()
for resource in resources['list']:
wap_client.resource_delete({'id': resource})
- #from tests.functional.purge_imap import purge_imap
- #purge_imap()
-
+ # from tests.functional.purge_imap import purge_imap
+ # purge_imap()
diff --git a/tests/functional/synchronize.py b/tests/functional/synchronize.py
index 7046db2..428ea74 100644
--- a/tests/functional/synchronize.py
+++ b/tests/functional/synchronize.py
@@ -1,5 +1,6 @@
from pykolab.auth import Auth
+
def synchronize_once():
auth = Auth()
auth.connect()
diff --git a/tests/functional/test_kolabd/__init__.py b/tests/functional/test_kolabd/__init__.py
index d7bf27f..d6cdb57 100644
--- a/tests/functional/test_kolabd/__init__.py
+++ b/tests/functional/test_kolabd/__init__.py
@@ -1,5 +1,6 @@
import pykolab
+
def setup_package():
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
diff --git a/tests/functional/test_kolabd/test_001_user_sync.py b/tests/functional/test_kolabd/test_001_user_sync.py
index 671188a..e8c804d 100644
--- a/tests/functional/test_kolabd/test_001_user_sync.py
+++ b/tests/functional/test_kolabd/test_001_user_sync.py
@@ -8,6 +8,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestKolabDaemon(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -61,7 +62,7 @@ class TestKolabDaemon(unittest.TestCase):
result = wap_client.user_info(recipient)
- if not result.has_key('mailhost'):
+ if 'mailhost' not in result:
from tests.functional.synchronize import synchronize_once
synchronize_once()
@@ -106,14 +107,14 @@ class TestKolabDaemon(unittest.TestCase):
print metadata
folder_name = '/'.join(folder.split('/')[2:]).split('@')[0]
- if ac_folders.has_key(folder_name):
- if ac_folders[folder_name].has_key('annotations'):
+ if folder_name in ac_folders:
+ if 'annotations' in ac_folders[folder_name]:
for _annotation in ac_folders[folder_name]['annotations'].keys():
if _annotation.startswith('/private'):
continue
_annotation_value = ac_folders[folder_name]['annotations'][_annotation]
- self.assertTrue(metadata[metadata.keys().pop()].has_key(_annotation))
+ self.assertTrue(_annotation in metadata[metadata.keys().pop()])
self.assertEqual(_annotation_value, metadata[metadata.keys().pop()][_annotation])
def test_006_user_subscriptions(self):
@@ -137,4 +138,3 @@ class TestKolabDaemon(unittest.TestCase):
def test_013_resource_mailbox_annotation(self):
pass
-
diff --git a/tests/functional/test_kolabd/test_002_user_rename.py b/tests/functional/test_kolabd/test_002_user_rename.py
index f526ade..3ac4a02 100644
--- a/tests/functional/test_kolabd/test_002_user_rename.py
+++ b/tests/functional/test_kolabd/test_002_user_rename.py
@@ -8,6 +8,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestKolabDaemon(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -39,7 +40,7 @@ class TestKolabDaemon(unittest.TestCase):
recipient = auth.find_recipient('john.doe@example.org')
user_info = wap_client.user_info(recipient)
- if not user_info.has_key('mailhost'):
+ if 'mailhost' not in user_info:
from tests.functional.synchronize import synchronize_once
synchronize_once()
@@ -77,4 +78,3 @@ class TestKolabDaemon(unittest.TestCase):
folders = imap.lm('user/joe.sixpack@example.org')
self.assertEqual(len(folders), 1, "INBOX for joe.sixpack does not exist")
-
diff --git a/tests/functional/test_kolabd/test_003_two_johns.py b/tests/functional/test_kolabd/test_003_two_johns.py
index b2bfb46..0f93969 100644
--- a/tests/functional/test_kolabd/test_003_two_johns.py
+++ b/tests/functional/test_kolabd/test_003_two_johns.py
@@ -8,6 +8,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestKolabDaemon(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -48,4 +49,3 @@ class TestKolabDaemon(unittest.TestCase):
folders = imap.lm('user/john.doe2@example.org')
self.assertEqual(len(folders), 1, "No INBOX found for second John")
-
diff --git a/tests/functional/test_postfix/__init__.py b/tests/functional/test_postfix/__init__.py
index d7bf27f..d6cdb57 100644
--- a/tests/functional/test_postfix/__init__.py
+++ b/tests/functional/test_postfix/__init__.py
@@ -1,5 +1,6 @@
import pykolab
+
def setup_package():
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
diff --git a/tests/functional/test_wallace/__init__.py b/tests/functional/test_wallace/__init__.py
index d7bf27f..d6cdb57 100644
--- a/tests/functional/test_wallace/__init__.py
+++ b/tests/functional/test_wallace/__init__.py
@@ -1,5 +1,6 @@
import pykolab
+
def setup_package():
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
diff --git a/tests/functional/test_wallace/test_001_user_add.py b/tests/functional/test_wallace/test_001_user_add.py
index d4e620a..a6945c9 100644
--- a/tests/functional/test_wallace/test_001_user_add.py
+++ b/tests/functional/test_wallace/test_001_user_add.py
@@ -1,4 +1,3 @@
-
from email import message_from_string
import time
@@ -11,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAdd(unittest.TestCase):
@classmethod
@@ -45,7 +45,7 @@ class TestUserAdd(unittest.TestCase):
folders = imap.lm('user/%(local)s@%(domain)s' % (self.john))
self.assertEqual(len(folders), 1)
-
+
folders = imap.lm('user/%(local)s@%(domain)s' % (self.jane))
self.assertEqual(len(folders), 1)
diff --git a/tests/functional/test_wallace/test_002_footer.py b/tests/functional/test_wallace/test_002_footer.py
index 4c1599c..d6e5836 100644
--- a/tests/functional/test_wallace/test_002_footer.py
+++ b/tests/functional/test_wallace/test_002_footer.py
@@ -17,6 +17,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestWallaceFooter(unittest.TestCase):
user = None
@@ -115,10 +116,10 @@ class TestWallaceFooter(unittest.TestCase):
def send_message(self, msg, _to=None, _from=None):
smtp = smtplib.SMTP('localhost', 10026)
- if _to == None:
+ if _to is None:
_to = self.send_to
- if _from == None:
+ if _from is None:
_from = self.send_from
smtp.sendmail(_from, _to, msg.as_string())
diff --git a/tests/functional/test_wallace/test_003_nonascii_subject.py b/tests/functional/test_wallace/test_003_nonascii_subject.py
index ff21aee..87d163a 100644
--- a/tests/functional/test_wallace/test_003_nonascii_subject.py
+++ b/tests/functional/test_wallace/test_003_nonascii_subject.py
@@ -19,6 +19,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestWallaceNonASCIISubject(unittest.TestCase):
@classmethod
@@ -83,10 +84,10 @@ class TestWallaceNonASCIISubject(unittest.TestCase):
def send_message(self, msg, _to=None, _from=None):
smtp = smtplib.SMTP('localhost', 10026)
- if _to == None:
+ if _to is None:
_to = self.send_to
- if _from == None:
+ if _from is None:
_from = self.send_from
smtp.sendmail(_from, _to, msg.as_string())
@@ -97,7 +98,7 @@ class TestWallaceNonASCIISubject(unittest.TestCase):
folders = imap.lm('user/%(local)s@%(domain)s' % (self.user))
self.assertEqual(len(folders), 1)
-
+
def test_002_send_nonascii_subject(self):
subject = Header(u"test_002_nonascii_subject chwaƂa")
body = "This is a test message"
@@ -123,4 +124,3 @@ class TestWallaceNonASCIISubject(unittest.TestCase):
if not self.check_message_delivered(subject):
raise Exception
-
diff --git a/tests/functional/test_wallace/test_004_nonascii_addresses.py b/tests/functional/test_wallace/test_004_nonascii_addresses.py
index 45df30e..42239c4 100644
--- a/tests/functional/test_wallace/test_004_nonascii_addresses.py
+++ b/tests/functional/test_wallace/test_004_nonascii_addresses.py
@@ -19,6 +19,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestWallaceNonASCIIAddresses(unittest.TestCase):
@classmethod
@@ -83,10 +84,10 @@ class TestWallaceNonASCIIAddresses(unittest.TestCase):
def send_message(self, msg, _to=None, _from=None):
smtp = smtplib.SMTP('localhost', 10026)
- if _to == None:
+ if _to is None:
_to = self.send_to
- if _from == None:
+ if _from is None:
_from = self.send_from
smtp.sendmail(_from, _to, msg.as_string())
@@ -97,7 +98,7 @@ class TestWallaceNonASCIIAddresses(unittest.TestCase):
folders = imap.lm('user/%(local)s@%(domain)s' % (self.user))
self.assertEqual(len(folders), 1)
-
+
def test_002_send_nonascii_addresses(self):
subject = Header(u"test_002_nonascii_addresses")
body = "This is a test message"
@@ -123,4 +124,3 @@ class TestWallaceNonASCIIAddresses(unittest.TestCase):
if not self.check_message_delivered(subject):
raise Exception
-
diff --git a/tests/functional/test_wallace/test_005_resource_add.py b/tests/functional/test_wallace/test_005_resource_add.py
index fc7f3ed..a378d9c 100644
--- a/tests/functional/test_wallace/test_005_resource_add.py
+++ b/tests/functional/test_wallace/test_005_resource_add.py
@@ -11,12 +11,13 @@ import tests.functional.resource_func as funcs
conf = pykolab.getConf()
+
class TestResourceAdd(unittest.TestCase):
@classmethod
def setUp(self):
from tests.functional.purge_users import purge_users
- #purge_users()
+ # purge_users()
self.john = {
'local': 'john.doe',
@@ -24,13 +25,13 @@ class TestResourceAdd(unittest.TestCase):
}
from tests.functional.user_add import user_add
- #user_add("John", "Doe")
+ # user_add("John", "Doe")
funcs.purge_resources()
self.audi = funcs.resource_add("car", "Audi A4")
self.passat = funcs.resource_add("car", "VW Passat")
self.boxter = funcs.resource_add("car", "Porsche Boxter S", kolabinvitationpolicy='ACT_ACCEPT_AND_NOTIFY')
- self.cars = funcs.resource_add("collection", "Company Cars", [ self.audi['dn'], self.passat['dn'], self.boxter['dn'] ], kolabinvitationpolicy='ACT_ACCEPT')
+ self.cars = funcs.resource_add("collection", "Company Cars", [self.audi['dn'], self.passat['dn'], self.boxter['dn']], kolabinvitationpolicy='ACT_ACCEPT')
from tests.functional.synchronize import synchronize_once
synchronize_once()
@@ -38,8 +39,8 @@ class TestResourceAdd(unittest.TestCase):
@classmethod
def tearDown(self):
from tests.functional.purge_users import purge_users
- #funcs.purge_resources()
- #purge_users()
+ # funcs.purge_resources()
+ # purge_users()
def test_001_resource_created(self):
resource = module_resources.resource_record_from_email_address(self.audi['mail'])
diff --git a/tests/functional/test_wallace/test_005_resource_invitation.py b/tests/functional/test_wallace/test_005_resource_invitation.py
index af84fa6..5429331 100644
--- a/tests/functional/test_wallace/test_005_resource_invitation.py
+++ b/tests/functional/test_wallace/test_005_resource_invitation.py
@@ -131,7 +131,6 @@ END:VEVENT
END:VCALENDAR
"""
-
itip_recurring = """
BEGIN:VCALENDAR
VERSION:2.0
@@ -178,8 +177,8 @@ Content-Transfer-Encoding: 8bit
--=_c8894dbdb8baeedacae836230e3436fd--
"""
-class TestResourceInvitation(unittest.TestCase):
+class TestResourceInvitation(unittest.TestCase):
john = None
@classmethod
@@ -192,7 +191,7 @@ class TestResourceInvitation(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
# set language to default
- pykolab.translate.setUserLanguage(conf.get('kolab','default_locale'))
+ pykolab.translate.setUserLanguage(conf.get('kolab', 'default_locale'))
self.itip_reply_subject = _("Reservation Request for %(summary)s was %(status)s")
@@ -223,14 +222,14 @@ class TestResourceInvitation(unittest.TestCase):
self.audi = funcs.resource_add("car", "Audi A4")
self.passat = funcs.resource_add("car", "VW Passat")
self.boxter = funcs.resource_add("car", "Porsche Boxter S")
- self.cars = funcs.resource_add("collection", "Company Cars", [ self.audi['dn'], self.passat['dn'], self.boxter['dn'] ])
+ self.cars = funcs.resource_add("collection", "Company Cars", [self.audi['dn'], self.passat['dn'], self.boxter['dn']])
self.room1 = funcs.resource_add("confroom", "Room 101", owner=self.jane['dn'], kolabinvitationpolicy='ACT_ACCEPT_AND_NOTIFY')
self.room2 = funcs.resource_add("confroom", "Conference Room B-222")
- self.rooms = funcs.resource_add("collection", "Rooms", [ self.room1['dn'], self.room2['dn'] ], self.jane['dn'], kolabinvitationpolicy='ACT_ACCEPT_AND_NOTIFY')
+ self.rooms = funcs.resource_add("collection", "Rooms", [self.room1['dn'], self.room2['dn']], self.jane['dn'], kolabinvitationpolicy='ACT_ACCEPT_AND_NOTIFY')
self.room3 = funcs.resource_add("confroom", "CEOs Office 303")
- self.viprooms = funcs.resource_add("collection", "VIP Rooms", [ self.room3['dn'] ], self.jane['dn'], kolabinvitationpolicy='ACT_MANUAL')
+ self.viprooms = funcs.resource_add("collection", "VIP Rooms", [self.room3['dn']], self.jane['dn'], kolabinvitationpolicy='ACT_MANUAL')
time.sleep(1)
from tests.functional.synchronize import synchronize_once
@@ -315,16 +314,16 @@ class TestResourceInvitation(unittest.TestCase):
return uid
-
def send_owner_response(self, event, partstat, from_addr=None):
if from_addr is None:
from_addr = self.jane['mail']
- itip_reply = event.to_message_itip(from_addr,
- method="REPLY",
- participant_status=partstat,
- message_text="Request " + partstat,
- subject="Booking has been %s" % (partstat)
+ itip_reply = event.to_message_itip(
+ from_addr,
+ method="REPLY",
+ participant_status=partstat,
+ message_text="Request " + partstat,
+ subject="Booking has been %s" % (partstat)
)
smtp = smtplib.SMTP('localhost', 10026)
@@ -405,7 +404,6 @@ class TestResourceInvitation(unittest.TestCase):
imap.imap.m.expunge()
imap.disconnect()
-
def find_resource_by_email(self, email):
resource = None
for r in [self.audi, self.passat, self.boxter, self.room1, self.room2]:
@@ -414,7 +412,6 @@ class TestResourceInvitation(unittest.TestCase):
break
return resource
-
def test_001_resource_from_email_address(self):
resource = module_resources.resource_record_from_email_address(self.audi['mail'])
self.assertEqual(len(resource), 1)
@@ -424,35 +421,32 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(len(collection), 1)
self.assertEqual(collection[0], self.cars['dn'])
-
def test_002_invite_resource(self):
- uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,7,13, 10,0,0))
+ uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 7, 13, 10, 0, 0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.audi['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.audi['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_resource_calendar_event(self.audi['kolabtargetfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
self.assertEqual(event.get_summary(), "test")
-
# @depends test_002_invite_resource
def test_003_invite_resource_conflict(self):
- uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,7,13, 12,0,0))
+ uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 7, 13, 12, 0, 0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.audi['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.audi['mail'])
self.assertIsInstance(response, email.message.Message)
self.assertEqual(self.check_resource_calendar_event(self.audi['kolabtargetfolder'], uid), None)
-
def test_004_invite_resource_collection(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.cars['mail'], datetime.datetime(2014,7,13, 12,0,0))
+ uid = self.send_itip_invitation(self.cars['mail'], datetime.datetime(2014, 7, 13, 12, 0, 0))
# one of the collection members accepted the reservation
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
delegatee = self.find_resource_by_email(accept['from'])
@@ -462,23 +456,22 @@ class TestResourceInvitation(unittest.TestCase):
self.assertIsInstance(self.check_resource_calendar_event(delegatee['kolabtargetfolder'], uid), pykolab.xml.Event)
# resource collection responds with a DELEGATED message
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DELEGATED') }, self.cars['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DELEGATED')}, self.cars['mail'])
self.assertIsInstance(response, email.message.Message)
self.assertIn("ROLE=NON-PARTICIPANT;RSVP=FALSE", str(response))
-
def test_005_rescheduling_reservation(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,4,1, 10,0,0))
+ uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 4, 1, 10, 0, 0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.audi['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.audi['mail'])
self.assertIsInstance(response, email.message.Message)
self.purge_mailbox(self.john['mailbox'])
- self.send_itip_update(self.audi['mail'], uid, datetime.datetime(2014,4,1, 12,0,0)) # conflict with myself
+ self.send_itip_update(self.audi['mail'], uid, datetime.datetime(2014, 4, 1, 12, 0, 0)) # conflict with myself
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.audi['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.audi['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_resource_calendar_event(self.audi['kolabtargetfolder'], uid)
@@ -486,28 +479,27 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(event.get_start().hour, 12)
self.assertEqual(event.get_sequence(), 2)
-
def test_005_rescheduling_collection(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.cars['mail'], datetime.datetime(2014,4,24, 12,0,0))
+ uid = self.send_itip_invitation(self.cars['mail'], datetime.datetime(2014, 4, 24, 12, 0, 0))
# one of the collection members accepted the reservation
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
delegatee = self.find_resource_by_email(accept['from'])
# book that resource for the next day
- self.send_itip_invitation(delegatee['mail'], datetime.datetime(2014,4,25, 14,0,0))
- accept2 = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ self.send_itip_invitation(delegatee['mail'], datetime.datetime(2014, 4, 25, 14, 0, 0))
+ accept2 = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
# re-schedule first booking to a conflicting date
self.purge_mailbox(self.john['mailbox'])
update_template = itip_delegated.replace("resource-car-audia4@example.org", delegatee['mail'])
- self.send_itip_update(delegatee['mail'], uid, datetime.datetime(2014,4,25, 12,0,0), template=update_template)
+ self.send_itip_update(delegatee['mail'], uid, datetime.datetime(2014, 4, 25, 12, 0, 0), template=update_template)
# expect response from another member of the initially delegated collection
- new_accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ new_accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(new_accept, email.message.Message)
new_delegatee = self.find_resource_by_email(new_accept['from'])
@@ -518,17 +510,16 @@ class TestResourceInvitation(unittest.TestCase):
self.assertIsInstance(event, pykolab.xml.Event)
# old resource responds with a DELEGATED message
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DELEGATED') }, delegatee['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DELEGATED')}, delegatee['mail'])
self.assertIsInstance(response, email.message.Message)
# old reservation was removed from old delegate's calendar
self.assertEqual(self.check_resource_calendar_event(delegatee['kolabtargetfolder'], uid), None)
-
def test_006_cancelling_revervation(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.boxter['mail'], datetime.datetime(2014,5,1, 10,0,0))
+ uid = self.send_itip_invitation(self.boxter['mail'], datetime.datetime(2014, 5, 1, 10, 0, 0))
self.assertIsInstance(self.check_resource_calendar_event(self.boxter['kolabtargetfolder'], uid), pykolab.xml.Event)
self.send_itip_cancel(self.boxter['mail'], uid)
@@ -537,20 +528,19 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(self.check_resource_calendar_event(self.boxter['kolabtargetfolder'], uid), None)
# make new reservation to the now free'd slot
- self.send_itip_invitation(self.boxter['mail'], datetime.datetime(2014,5,1, 9,0,0))
+ self.send_itip_invitation(self.boxter['mail'], datetime.datetime(2014, 5, 1, 9, 0, 0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.boxter['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.boxter['mail'])
self.assertIsInstance(response, email.message.Message)
-
def test_007_update_delegated(self):
self.purge_mailbox(self.john['mailbox'])
- dt = datetime.datetime(2014,8,1, 12,0,0)
+ dt = datetime.datetime(2014, 8, 1, 12, 0, 0)
uid = self.send_itip_invitation(self.cars['mail'], dt)
# wait for accept notification
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
delegatee = self.find_resource_by_email(accept['from'])
@@ -561,97 +551,91 @@ class TestResourceInvitation(unittest.TestCase):
self.send_itip_update(delegatee['mail'], uid, dt, template=update_template)
# get response from delegatee
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
self.assertIn(delegatee['mail'], accept['from'])
# no delegation response on updates
- self.assertEqual(self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DELEGATED') }, self.cars['mail']), None)
-
+ self.assertEqual(self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DELEGATED')}, self.cars['mail']), None)
def test_008_allday_reservation(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,6,2), True)
+ uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 6, 2), True)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
event = self.check_resource_calendar_event(self.audi['kolabtargetfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
self.assertIsInstance(event.get_start(), datetime.date)
- uid2 = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,6,2, 16,0,0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.audi['mail'])
+ uid2 = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 6, 2, 16, 0, 0))
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.audi['mail'])
self.assertIsInstance(response, email.message.Message)
-
def test_009_recurring_events(self):
self.purge_mailbox(self.john['mailbox'])
# register an infinitely recurring resource invitation
- uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,2,20, 12,0,0),
+ uid = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 2, 20, 12, 0, 0),
template=itip_recurring.replace(";COUNT=10", ""))
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
# check non-recurring against recurring
- uid2 = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,3,13, 10,0,0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.audi['mail'])
+ uid2 = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 3, 13, 10, 0, 0))
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.audi['mail'])
self.assertIsInstance(response, email.message.Message)
self.purge_mailbox(self.john['mailbox'])
# check recurring against recurring
- uid3 = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,2,22, 8,0,0), template=itip_recurring)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ uid3 = self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 2, 22, 8, 0, 0), template=itip_recurring)
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
self.assertIsInstance(accept, email.message.Message)
-
def test_010_invalid_bookings(self):
self.purge_mailbox(self.john['mailbox'])
itip_other = itip_invitation.replace("mailto:%s", "mailto:some-other-resource@example.org\nCOMMENT: Sent to %s")
- self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,3,22, 8,0,0), template=itip_other)
+ self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 3, 22, 8, 0, 0), template=itip_other)
time.sleep(1)
itip_invalid = itip_invitation.replace("DTSTART;", "X-DTSTART;")
- self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014,3,24, 19,30,0), template=itip_invalid)
-
- self.assertEqual(self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.audi['mail']), None)
+ self.send_itip_invitation(self.audi['mail'], datetime.datetime(2014, 3, 24, 19, 30, 0), template=itip_invalid)
+ self.assertEqual(self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.audi['mail']), None)
def test_011_owner_info(self):
self.purge_mailbox(self.john['mailbox'])
- self.send_itip_invitation(self.room1['mail'], datetime.datetime(2014,6,19, 16,0,0))
+ self.send_itip_invitation(self.room1['mail'], datetime.datetime(2014, 6, 19, 16, 0, 0))
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.room1['mail'])
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.room1['mail'])
self.assertIsInstance(accept, email.message.Message)
respose_text = str(accept.get_payload(0))
self.assertIn(self.jane['mail'], respose_text)
self.assertIn(self.jane['displayname'], respose_text)
-
def test_011_owner_info_from_collection(self):
self.purge_mailbox(self.john['mailbox'])
- self.send_itip_invitation(self.room2['mail'], datetime.datetime(2014,6,19, 16,0,0))
+ self.send_itip_invitation(self.room2['mail'], datetime.datetime(2014, 6, 19, 16, 0, 0))
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.room2['mail'])
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.room2['mail'])
self.assertIsInstance(accept, email.message.Message)
respose_text = str(accept.get_payload(0))
self.assertIn(self.jane['mail'], respose_text)
self.assertIn(self.jane['displayname'], respose_text)
-
def test_012_owner_notification(self):
self.purge_mailbox(self.john['mailbox'])
self.purge_mailbox(self.jane['mailbox'])
- self.send_itip_invitation(self.room1['mail'], datetime.datetime(2014,8,4, 13,0,0))
+ self.send_itip_invitation(self.room1['mail'], datetime.datetime(2014, 8, 4, 13, 0, 0))
# check notification message sent to resource owner (jane)
notify = self.check_message_received(_('Booking for %s has been %s') % (self.room1['cn'], participant_status_label('ACCEPTED')), self.room1['mail'], self.jane['mailbox'])
@@ -664,25 +648,24 @@ class TestResourceInvitation(unittest.TestCase):
self.purge_mailbox(self.john['mailbox'])
# check notification sent to collection owner (jane)
- self.send_itip_invitation(self.rooms['mail'], datetime.datetime(2014,8,4, 12,30,0))
+ self.send_itip_invitation(self.rooms['mail'], datetime.datetime(2014, 8, 4, 12, 30, 0))
# one of the collection members accepted the reservation
- accepted = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accepted = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')})
delegatee = self.find_resource_by_email(accepted['from'])
notify = self.check_message_received(_('Booking for %s has been %s') % (delegatee['cn'], participant_status_label('ACCEPTED')), delegatee['mail'], self.jane['mailbox'])
self.assertIsInstance(notify, email.message.Message)
self.assertIn(self.john['mail'], notification_text)
-
def test_013_owner_confirmation_accept(self):
self.purge_mailbox(self.john['mailbox'])
self.purge_mailbox(self.jane['mailbox'])
- uid = self.send_itip_invitation(self.room3['mail'], datetime.datetime(2014,9,12, 14,0,0))
+ uid = self.send_itip_invitation(self.room3['mail'], datetime.datetime(2014, 9, 12, 14, 0, 0))
# requester (john) gets a TENTATIVE confirmation
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_resource_calendar_event(self.room3['kolabtargetfolder'], uid)
@@ -699,7 +682,7 @@ class TestResourceInvitation(unittest.TestCase):
self.send_owner_response(itip_event['xml'], 'ACCEPTED', from_addr=self.jane['mail'])
# requester (john) now gets the ACCEPTED response
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_resource_calendar_event(self.room3['kolabtargetfolder'], uid)
@@ -707,15 +690,14 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(event.get_status(True), 'CONFIRMED')
self.assertEqual(event.get_attendee_by_email(self.room3['mail']).get_participant_status(True), 'ACCEPTED')
-
def test_014_owner_confirmation_decline(self):
self.purge_mailbox(self.john['mailbox'])
self.purge_mailbox(self.jane['mailbox'])
- uid = self.send_itip_invitation(self.room3['mail'], datetime.datetime(2014,9,14, 9,0,0))
+ uid = self.send_itip_invitation(self.room3['mail'], datetime.datetime(2014, 9, 14, 9, 0, 0))
# requester (john) gets a TENTATIVE confirmation
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
# check confirmation message sent to resource owner (jane)
@@ -725,11 +707,12 @@ class TestResourceInvitation(unittest.TestCase):
itip_event = events_from_message(notify)[0]
# resource owner declines reservation request
- itip_reply = itip_event['xml'].to_message_itip(self.jane['mail'],
- method="REPLY",
- participant_status='DECLINED',
- message_text="Request declined",
- subject=_('Booking for %s has been %s') % (self.room3['cn'], participant_status_label('DECLINED'))
+ itip_reply = itip_event['xml'].to_message_itip(
+ self.jane['mail'],
+ method="REPLY",
+ participant_status='DECLINED',
+ message_text="Request declined",
+ subject=_('Booking for %s has been %s') % (self.room3['cn'], participant_status_label('DECLINED'))
)
smtp = smtplib.SMTP('localhost', 10026)
@@ -737,23 +720,22 @@ class TestResourceInvitation(unittest.TestCase):
smtp.quit()
# requester (john) now gets the DECLINED response
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
# tentative reservation was set to cancelled
event = self.check_resource_calendar_event(self.room3['kolabtargetfolder'], uid)
self.assertEqual(event, None)
- #self.assertEqual(event.get_status(True), 'CANCELLED')
- #self.assertEqual(event.get_attendee_by_email(self.room3['mail']).get_participant_status(True), 'DECLINED')
-
+ # self.assertEqual(event.get_status(True), 'CANCELLED')
+ # self.assertEqual(event.get_attendee_by_email(self.room3['mail']).get_participant_status(True), 'DECLINED')
def test_015_owner_confirmation_update(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.room3['mail'], datetime.datetime(2014,8,19, 9,0,0), uid="http://a-totally.stupid/?uid")
+ uid = self.send_itip_invitation(self.room3['mail'], datetime.datetime(2014, 8, 19, 9, 0, 0), uid="http://a-totally.stupid/?uid")
# requester (john) gets a TENTATIVE confirmation
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
# check first confirmation message sent to resource owner (jane)
@@ -767,7 +749,7 @@ class TestResourceInvitation(unittest.TestCase):
self.purge_mailbox(self.john['mailbox'])
# send update with new date (and sequence)
- self.send_itip_update(self.room3['mail'], uid, datetime.datetime(2014,8,19, 16,0,0))
+ self.send_itip_update(self.room3['mail'], uid, datetime.datetime(2014, 8, 19, 16, 0, 0))
event = self.check_resource_calendar_event(self.room3['kolabtargetfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
@@ -781,11 +763,12 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(itip_event2['start'].hour, 16)
# resource owner declines the first reservation request
- itip_reply = itip_event1['xml'].to_message_itip(self.jane['mail'],
- method="REPLY",
- participant_status='DECLINED',
- message_text="Request declined",
- subject=_('Booking for %s has been %s') % (self.room3['cn'], participant_status_label('DECLINED'))
+ itip_reply = itip_event1['xml'].to_message_itip(
+ self.jane['mail'],
+ method="REPLY",
+ participant_status='DECLINED',
+ message_text="Request declined",
+ subject=_('Booking for %s has been %s') % (self.room3['cn'], participant_status_label('DECLINED'))
)
smtp = smtplib.SMTP('localhost', 10026)
smtp.sendmail(self.jane['mail'], str(itip_event1['organizer']), str(itip_reply))
@@ -794,36 +777,36 @@ class TestResourceInvitation(unittest.TestCase):
time.sleep(5)
# resource owner accpets the second reservation request
- itip_reply = itip_event2['xml'].to_message_itip(self.jane['mail'],
- method="REPLY",
- participant_status='ACCEPTED',
- message_text="Request accepred",
- subject=_('Booking for %s has been %s') % (self.room3['cn'], participant_status_label('ACCEPTED'))
+ itip_reply = itip_event2['xml'].to_message_itip(
+ self.jane['mail'],
+ method="REPLY",
+ participant_status='ACCEPTED',
+ message_text="Request accepred",
+ subject=_('Booking for %s has been %s') % (self.room3['cn'], participant_status_label('ACCEPTED'))
)
smtp = smtplib.SMTP('localhost', 10026)
smtp.sendmail(self.jane['mail'], str(itip_event2['organizer']), str(itip_reply))
smtp.quit()
# requester (john) now gets the ACCEPTED response
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_resource_calendar_event(self.room3['kolabtargetfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
self.assertEqual(event.get_attendee_by_email(self.room3['mail']).get_participant_status(True), 'ACCEPTED')
-
def test_016_collection_owner_confirmation(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.viprooms['mail'], datetime.datetime(2014,8,15, 17,0,0))
+ uid = self.send_itip_invitation(self.viprooms['mail'], datetime.datetime(2014, 8, 15, 17, 0, 0))
# resource collection responds with a DELEGATED message
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DELEGATED') }, self.viprooms['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DELEGATED')}, self.viprooms['mail'])
self.assertIsInstance(response, email.message.Message)
# the collection member tentatively accepted the reservation
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') })
+ accept = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')})
self.assertIsInstance(accept, email.message.Message)
self.assertIn(self.room3['mail'], accept['from'])
@@ -831,15 +814,17 @@ class TestResourceInvitation(unittest.TestCase):
notify = self.check_message_received(_('Booking request for %s requires confirmation') % (self.room3['cn']), mailbox=self.jane['mailbox'])
self.assertIsInstance(notify, email.message.Message)
-
def test_017_reschedule_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
+ subject = {'summary': 'test', 'status': participant_status_label('ACCEPTED')}
+ subject = self.itip_reply_subject % (subject)
+
# register a recurring resource invitation
- start = datetime.datetime(2015,2,10, 12,0,0)
+ start = datetime.datetime(2015, 2, 10, 12, 0, 0)
uid = self.send_itip_invitation(self.audi['mail'], start, template=itip_recurring)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.purge_mailbox(self.john['mailbox'])
@@ -849,7 +834,7 @@ class TestResourceInvitation(unittest.TestCase):
exstart = exdate + datetime.timedelta(hours=5)
self.send_itip_update(self.audi['mail'], uid, exstart, instance=exdate)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + exdate.strftime('%Y%m%dT%H%M%S'), str(accept))
@@ -860,7 +845,7 @@ class TestResourceInvitation(unittest.TestCase):
# send new invitation for now free slot
uid = self.send_itip_invitation(self.audi['mail'], exdate, template=itip_invitation.replace('SUMMARY:test', 'SUMMARY:new'))
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'new', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
# send rescheduling request to that single instance again: now conflicting
@@ -868,29 +853,31 @@ class TestResourceInvitation(unittest.TestCase):
exstart = exdate + datetime.timedelta(hours=2)
self.send_itip_update(self.audi['mail'], uid, exstart, instance=exdate, sequence=3)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') })
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')})
self.assertIsInstance(response, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:", str(response))
-
def test_018_invite_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
self.purge_mailbox(self.boxter['kolabtargetfolder'])
- start = datetime.datetime(2015,3,2, 18,30,0)
+ subject = {'summary': 'test', 'status': participant_status_label('ACCEPTED')}
+ subject = self.itip_reply_subject % (subject)
+
+ start = datetime.datetime(2015, 3, 2, 18, 30, 0)
uid = self.send_itip_invitation(self.boxter['mail'], start, instance=start)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + start.strftime('%Y%m%dT%H%M%S'), str(accept))
self.purge_mailbox(self.john['mailbox'])
# send a second invitation for another instance with the same UID
- nextstart = datetime.datetime(2015,3,9, 18,30,0)
+ nextstart = datetime.datetime(2015, 3, 9, 18, 30, 0)
self.send_itip_invitation(self.boxter['mail'], nextstart, uid=uid, instance=nextstart)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + nextstart.strftime('%Y%m%dT%H%M%S'), str(accept))
@@ -900,7 +887,7 @@ class TestResourceInvitation(unittest.TestCase):
exstart = start + datetime.timedelta(hours=2)
self.send_itip_update(self.boxter['mail'], uid, exstart, instance=start)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + start.strftime('%Y%m%dT%H%M%S'), str(accept))
@@ -919,7 +906,7 @@ class TestResourceInvitation(unittest.TestCase):
# send rescheduling request to the 2nd instance
self.send_itip_update(self.boxter['mail'], uid, nextstart + datetime.timedelta(hours=2), sequence=2, instance=nextstart)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + nextstart.strftime('%Y%m%dT%H%M%S'), str(accept))
@@ -932,15 +919,17 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(two.get_sequence(), 2)
self.assertEqual(two.get_start().hour, 20)
-
def test_019_cancel_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
+ subject = {'summary': 'test', 'status': participant_status_label('ACCEPTED')}
+ subject = self.itip_reply_subject % (subject)
+
# register a recurring resource invitation
- start = datetime.datetime(2015,2,12, 14,0,0)
+ start = datetime.datetime(2015, 2, 12, 14, 0, 0)
uid = self.send_itip_invitation(self.passat['mail'], start, template=itip_recurring)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
exdate = start + datetime.timedelta(days=7)
@@ -958,10 +947,10 @@ class TestResourceInvitation(unittest.TestCase):
self.purge_mailbox(self.john['mailbox'])
# store a single occurrence with recurrence-id
- start = datetime.datetime(2015,3,2, 18,30,0)
+ start = datetime.datetime(2015, 3, 2, 18, 30, 0)
uid = self.send_itip_invitation(self.passat['mail'], start, instance=start)
- accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ accept = self.check_message_received(subject)
self.assertIsInstance(accept, email.message.Message)
self.send_itip_cancel(self.passat['mail'], uid, instance=start)
@@ -969,12 +958,11 @@ class TestResourceInvitation(unittest.TestCase):
time.sleep(5) # wait for IMAP to update
self.assertEqual(self.check_resource_calendar_event(self.passat['kolabtargetfolder'], uid), None)
-
def test_020_owner_confirmation_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
self.purge_mailbox(self.jane['mailbox'])
- start = datetime.datetime(2015,4,18, 14,0,0)
+ start = datetime.datetime(2015, 4, 18, 14, 0, 0)
uid = self.send_itip_invitation(self.room3['mail'], start, template=itip_recurring)
notify = self.check_message_received(_('Booking request for %s requires confirmation') % (self.room3['cn']), mailbox=self.jane['mailbox'])
@@ -1004,7 +992,7 @@ class TestResourceInvitation(unittest.TestCase):
self.send_owner_response(itip_event['xml'], 'DECLINED', from_addr=self.jane['mail'])
# requester (john) now gets the DECLINED response
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.room3['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.room3['mail'])
self.assertIsInstance(response, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + exdate.strftime('%Y%m%dT%H%M%S'), str(response))
@@ -1014,4 +1002,3 @@ class TestResourceInvitation(unittest.TestCase):
exception = event.get_instance(exdate)
self.assertEqual(exception.get_attendee_by_email(self.room3['mail']).get_participant_status(True), 'DECLINED')
-
diff --git a/tests/functional/test_wallace/test_006_resource_performance.py b/tests/functional/test_wallace/test_006_resource_performance.py
index ed83611..814a111 100644
--- a/tests/functional/test_wallace/test_006_resource_performance.py
+++ b/tests/functional/test_wallace/test_006_resource_performance.py
@@ -35,7 +35,7 @@ class TestWallacePerformance(unittest.TestCase):
funcs.purge_resources()
self.room1 = funcs.resource_add("confroom", "Room 101")
self.room2 = funcs.resource_add("confroom", "Conference Room B-222")
- self.rooms = funcs.resource_add("collection", "Rooms", [ self.room1['dn'], self.room2['dn'] ])
+ self.rooms = funcs.resource_add("collection", "Rooms", [self.room1['dn'], self.room2['dn']])
time.sleep(1)
synchronize_once()
@@ -74,7 +74,6 @@ class TestWallacePerformance(unittest.TestCase):
saved = module_resources.save_resource_event(dict(xml=event), resource)
i += 1
-
def test_001_save_resource_event(self):
event = Event()
event.set_summary("test")
@@ -86,23 +85,22 @@ class TestWallacePerformance(unittest.TestCase):
saved = module_resources.save_resource_event(dict(xml=event), self.room1)
self.assertTrue(saved)
-
def test_002_read_resource_calendar(self):
self.purge_mailbox(self.room1['kolabtargetfolder'])
event = Event()
event.set_summary("test")
- event.set_start(datetime.datetime(2014,4,1, 12,0,0, tzinfo=pytz.timezone("Europe/London")))
- event.set_end(datetime.datetime(2014,4,1, 14,0,0, tzinfo=pytz.timezone("Europe/London")))
+ event.set_start(datetime.datetime(2014, 4, 1, 12, 0, 0, tzinfo=pytz.timezone("Europe/London")))
+ event.set_end(datetime.datetime(2014, 4, 1, 14, 0, 0, tzinfo=pytz.timezone("Europe/London")))
saved = module_resources.save_resource_event(dict(xml=event), self.room1)
self.assertTrue(saved)
uid = event.get_uid()
itip = dict(
- uid = str(uuid.uuid4()),
- sequence = 0,
- start = datetime.datetime(2014,4,1, 13,0,0, tzinfo=pytz.timezone("Europe/London")),
- end = datetime.datetime(2014,4,1, 14,30,0, tzinfo=pytz.timezone("Europe/London"))
+ uid=str(uuid.uuid4()),
+ sequence=0,
+ start=datetime.datetime(2014, 4, 1, 13, 0, 0, tzinfo=pytz.timezone("Europe/London")),
+ end=datetime.datetime(2014, 4, 1, 14, 30, 0, tzinfo=pytz.timezone("Europe/London"))
)
event.set_uid(itip['uid'])
@@ -110,12 +108,11 @@ class TestWallacePerformance(unittest.TestCase):
event.set_end(itip['end'])
itip['xml'] = event
- res = module_resources.read_resource_calendar(self.room1, [ itip ])
+ res = module_resources.read_resource_calendar(self.room1, [itip])
self.assertEqual(res, 1)
self.assertTrue(self.room1['conflict'])
self.assertIn(uid, self.room1['conflicting_events'])
-
def test_003_read_time(self):
self.purge_mailbox(self.room1['kolabtargetfolder'])
@@ -125,10 +122,10 @@ class TestWallacePerformance(unittest.TestCase):
self.populate_calendar(self.room1, num, date)
itip = dict(
- uid = str(uuid.uuid4()),
- sequence = 0,
- start = date,
- end = date + datetime.timedelta(minutes=90)
+ uid=str(uuid.uuid4()),
+ sequence=0,
+ start=date,
+ end=date + datetime.timedelta(minutes=90)
)
event = Event()
@@ -138,7 +135,7 @@ class TestWallacePerformance(unittest.TestCase):
itip['xml'] = event
start = time.time()
- res = module_resources.read_resource_calendar(self.room1, [ itip ])
+ res = module_resources.read_resource_calendar(self.room1, [itip])
self.assertEqual(res, num)
print "\nREAD TIME:", time.time() - start
diff --git a/tests/functional/test_wallace/test_007_invitationpolicy.py b/tests/functional/test_wallace/test_007_invitationpolicy.py
index f019a91..e11e906 100644
--- a/tests/functional/test_wallace/test_007_invitationpolicy.py
+++ b/tests/functional/test_wallace/test_007_invitationpolicy.py
@@ -221,6 +221,7 @@ Content-Transfer-Encoding: 8bit
--=_c8894dbdb8baeedacae836230e3436fd--
"""
+
class TestWallaceInvitationpolicy(unittest.TestCase):
john = None
@@ -236,7 +237,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
# set language to default
- pykolab.translate.setUserLanguage(conf.get('kolab','default_locale'))
+ pykolab.translate.setUserLanguage(conf.get('kolab', 'default_locale'))
self.itip_reply_subject = _('"%(summary)s" has been %(status)s')
@@ -251,7 +252,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'mailbox': 'user/john.doe@example.org',
'kolabcalendarfolder': 'user/john.doe/Calendar@example.org',
'kolabtasksfolder': 'user/john.doe/Tasks@example.org',
- 'kolabinvitationpolicy': ['ACT_UPDATE_AND_NOTIFY','ACT_MANUAL']
+ 'kolabinvitationpolicy': ['ACT_UPDATE_AND_NOTIFY', 'ACT_MANUAL']
}
self.jane = {
@@ -263,7 +264,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'kolabcalendarfolder': 'user/jane.manager/Calendar@example.org',
'kolabtasksfolder': 'user/jane.manager/Tasks@example.org',
'kolabconfidentialcalendar': 'user/jane.manager/Calendar/Confidential@example.org',
- 'kolabinvitationpolicy': ['ACT_ACCEPT_IF_NO_CONFLICT','ACT_REJECT_IF_CONFLICT','TASK_ACCEPT','TASK_UPDATE_AND_NOTIFY','ACT_UPDATE']
+ 'kolabinvitationpolicy': ['ACT_ACCEPT_IF_NO_CONFLICT', 'ACT_REJECT_IF_CONFLICT', 'TASK_ACCEPT', 'TASK_UPDATE_AND_NOTIFY', 'ACT_UPDATE']
}
self.jack = {
@@ -274,7 +275,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'mailbox': 'user/jack.tentative@example.org',
'kolabcalendarfolder': 'user/jack.tentative/Calendar@example.org',
'kolabtasksfolder': 'user/jack.tentative/Tasks@example.org',
- 'kolabinvitationpolicy': ['ACT_TENTATIVE_IF_NO_CONFLICT','ALL_SAVE_TO_FOLDER','ACT_UPDATE']
+ 'kolabinvitationpolicy': ['ACT_TENTATIVE_IF_NO_CONFLICT', 'ALL_SAVE_TO_FOLDER', 'ACT_UPDATE']
}
self.mark = {
@@ -285,7 +286,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'mailbox': 'user/mark.german@example.org',
'kolabcalendarfolder': 'user/mark.german/Calendar@example.org',
'kolabtasksfolder': 'user/mark.german/Tasks@example.org',
- 'kolabinvitationpolicy': ['ACT_ACCEPT','ACT_UPDATE_AND_NOTIFY']
+ 'kolabinvitationpolicy': ['ACT_ACCEPT', 'ACT_UPDATE_AND_NOTIFY']
}
self.lucy = {
@@ -296,7 +297,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'mailbox': 'user/lucy.meyer@example.org',
'kolabcalendarfolder': 'user/lucy.meyer/Calendar@example.org',
'kolabtasksfolder': 'user/lucy.meyer/Tasks@example.org',
- 'kolabinvitationpolicy': ['ALL_SAVE_AND_FORWARD','ACT_CANCEL_DELETE_AND_NOTIFY','ACT_UPDATE_AND_NOTIFY']
+ 'kolabinvitationpolicy': ['ALL_SAVE_AND_FORWARD', 'ACT_CANCEL_DELETE_AND_NOTIFY', 'ACT_UPDATE_AND_NOTIFY']
}
self.bill = {
@@ -307,7 +308,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'mailbox': 'user/bill.mayor@example.org',
'kolabcalendarfolder': 'user/bill.mayor/Calendar@example.org',
'kolabtasksfolder': 'user/bill.mayor/Tasks@example.org',
- 'kolabinvitationpolicy': ['ALL_SAVE_TO_FOLDER:lucy.meyer@example.org','ALL_REJECT']
+ 'kolabinvitationpolicy': ['ALL_SAVE_TO_FOLDER:lucy.meyer@example.org', 'ALL_REJECT']
}
self.external = {
@@ -330,7 +331,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
# create confidential calendar folder for jane
imap = IMAP()
- imap.connect(domain='example.org') # sets self.domain
+ imap.connect(domain='example.org') # sets self.domain
imap.user_mailbox_create_additional_folders(self.jane['mail'], {
'Calendar/Confidential': {
'annotations': {
@@ -343,7 +344,6 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
imap.set_acl(imap.folder_quote(self.jane['kolabcalendarfolder']), self.mark['mail'], "lrswipkxtecda")
imap.disconnect()
-
def send_message(self, itip_payload, to_addr, from_addr=None, method="REQUEST"):
if from_addr is None:
from_addr = self.john['mail']
@@ -672,12 +672,11 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
imap.imap.m.expunge()
imap.disconnect()
-
def test_001_invite_accept_udate(self):
- start = datetime.datetime(2014,8,13, 10,0,0)
+ start = datetime.datetime(2014, 8, 13, 10, 0, 0)
uid = self.send_itip_invitation(self.jane['mail'], start)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
@@ -693,38 +692,35 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(event.get_summary(), "test updated")
self.assertEqual(event.get_attendee(self.jane['mail']).get_participant_status(), kolabformat.PartAccepted)
-
# @depends on test_001_invite_user
def test_002_invite_conflict_reject(self):
- uid = self.send_itip_invitation(self.jane['mail'], datetime.datetime(2014,8,13, 11,0,0), summary="test2")
+ uid = self.send_itip_invitation(self.jane['mail'], datetime.datetime(2014, 8, 13, 11, 0, 0), summary="test2")
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test2', 'status':participant_status_label('DECLINED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test2', 'status': participant_status_label('DECLINED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
self.assertEqual(event.get_summary(), "test2")
-
def test_003_invite_accept_tentative(self):
self.purge_mailbox(self.john['mailbox'])
- uid = self.send_itip_invitation(self.jack['mail'], datetime.datetime(2014,7,24, 8,0,0))
+ uid = self.send_itip_invitation(self.jack['mail'], datetime.datetime(2014, 7, 24, 8, 0, 0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') }, self.jack['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')}, self.jack['mail'])
self.assertIsInstance(response, email.message.Message)
-
def test_004_copy_to_calendar(self):
self.purge_mailbox(self.john['mailbox'])
- self.send_itip_invitation(self.jack['mail'], datetime.datetime(2014,7,29, 8,0,0))
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') }, self.jack['mail'])
+ self.send_itip_invitation(self.jack['mail'], datetime.datetime(2014, 7, 29, 8, 0, 0))
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')}, self.jack['mail'])
self.assertIsInstance(response, email.message.Message)
# send conflicting request to jack
- uid = self.send_itip_invitation(self.jack['mail'], datetime.datetime(2014,7,29, 10,0,0), summary="test2")
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test2', 'status':participant_status_label('DECLINED') }, self.jack['mail'])
+ uid = self.send_itip_invitation(self.jack['mail'], datetime.datetime(2014, 7, 29, 10, 0, 0), summary="test2")
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test2', 'status': participant_status_label('DECLINED')}, self.jack['mail'])
self.assertEqual(response, None, "No reply expected")
event = self.check_user_calendar_event(self.jack['kolabcalendarfolder'], uid)
@@ -732,10 +728,9 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(event.get_summary(), "test2")
self.assertEqual(event.get_attendee(self.jack['mail']).get_participant_status(), kolabformat.PartNeedsAction)
-
def test_004_copy_to_calendar_and_forward(self):
- uid = self.send_itip_invitation(self.lucy['mail'], datetime.datetime(2015,2,11, 14,0,0), summary="test forward")
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test forward', 'status':participant_status_label('ACCEPTED') }, self.lucy['mail'], self.lucy['mailbox'])
+ uid = self.send_itip_invitation(self.lucy['mail'], datetime.datetime(2015, 2, 11, 14, 0, 0), summary="test forward")
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test forward', 'status': participant_status_label('ACCEPTED')}, self.lucy['mail'], self.lucy['mailbox'])
self.assertEqual(response, None, "No reply expected")
event = self.check_user_calendar_event(self.lucy['kolabcalendarfolder'], uid)
@@ -748,18 +743,17 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertIsInstance(message, email.message.Message)
itips = events_from_message(message)
- self.assertEqual(len(itips), 1);
- self.assertEqual(itips[0]['method'], 'REQUEST');
- self.assertEqual(itips[0]['uid'], uid);
-
+ self.assertEqual(len(itips), 1)
+ self.assertEqual(itips[0]['method'], 'REQUEST')
+ self.assertEqual(itips[0]['uid'], uid)
def test_005_invite_rescheduling_accept(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2014,8,14, 9,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 14, 9, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.send_itip_invitation(self.jane['mail'], start)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
@@ -769,10 +763,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.purge_mailbox(self.john['mailbox'])
# send update with new date and incremented sequence
- new_start = pytz.timezone("Europe/Berlin").localize(datetime.datetime(2014,8,15, 15,0,0))
+ new_start = pytz.timezone("Europe/Berlin").localize(datetime.datetime(2014, 8, 15, 15, 0, 0))
self.send_itip_update(self.jane['mail'], uid, new_start, summary="test", sequence=1)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
@@ -780,23 +774,22 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(event.get_start(), new_start)
self.assertEqual(event.get_sequence(), 1)
-
def test_005_invite_rescheduling_reject(self):
self.purge_mailbox(self.john['mailbox'])
self.purge_mailbox(self.jack['kolabcalendarfolder'])
- start = datetime.datetime(2014,8,9, 17,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 9, 17, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.send_itip_invitation(self.jack['mail'], start)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') }, self.jack['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('TENTATIVE')}, self.jack['mail'])
self.assertIsInstance(response, email.message.Message)
# send update with new but conflicting date and incremented sequence
- self.create_calendar_event(datetime.datetime(2014,8,10, 10,30,0, tzinfo=pytz.timezone("Europe/Berlin")), user=self.jack)
- new_start = pytz.timezone("Europe/Berlin").localize(datetime.datetime(2014,8,10, 9,30,0))
+ self.create_calendar_event(datetime.datetime(2014, 8, 10, 10, 30, 0, tzinfo=pytz.timezone("Europe/Berlin")), user=self.jack)
+ new_start = pytz.timezone("Europe/Berlin").localize(datetime.datetime(2014, 8, 10, 9, 30, 0))
self.send_itip_update(self.jack['mail'], uid, new_start, summary="test (updated)", sequence=1)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.jack['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.jack['mail'])
self.assertEqual(response, None)
# verify re-scheduled copy in jack's calendar with NEEDS-ACTION
@@ -809,11 +802,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertTrue(attendee.get_rsvp())
self.assertEqual(attendee.get_participant_status(), kolabformat.PartNeedsAction)
-
def test_006_invitation_reply(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2014,8,18, 14,30,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 18, 14, 30, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.john)
event = self.check_user_calendar_event(self.john['kolabcalendarfolder'], uid)
@@ -836,11 +828,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(len(attachments), 1)
self.assertEqual(event.get_attachment_data(0), 'This is a text attachment')
-
def test_006_invitation_reply_delegated(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2014,8,28, 14,30,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 28, 14, 30, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.john)
event = self.check_user_calendar_event(self.john['kolabcalendarfolder'], uid)
@@ -866,13 +857,12 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(len(delegatee.get_delegated_from()), 1)
self.assertEqual(delegatee.get_delegated_from(True)[0], self.jane['mail'])
-
def test_007_invitation_cancel(self):
self.purge_mailbox(self.john['mailbox'])
uid = self.send_itip_invitation(self.jane['mail'], summary="cancelled")
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'cancelled', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'cancelled', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
self.send_itip_cancel(self.jane['mail'], uid, summary="cancelled")
@@ -884,7 +874,6 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(event.get_status(True), 'CANCELLED')
self.assertTrue(event.get_transparency())
-
def test_007_invitation_cancel_and_delete(self):
self.purge_mailbox(self.john['mailbox'])
@@ -900,11 +889,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
# verify event was removed from the user's calendar
self.assertEqual(self.check_user_calendar_event(self.lucy['kolabcalendarfolder'], uid), None)
-
def test_008_inivtation_reply_notify(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2014,8,12, 16,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 12, 16, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.john, attendees=[self.jane, self.mark, self.jack])
# send a reply from jane to john
@@ -921,7 +909,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
notification = self.check_message_received(_('"%s" has been updated') % ('test'), self.john['mail'])
self.assertIsInstance(notification, email.message.Message)
- notification_text = str(notification.get_payload());
+ notification_text = str(notification.get_payload())
self.assertIn(self.jane['mail'], notification_text)
self.assertIn(_("PENDING"), notification_text)
@@ -934,14 +922,13 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
notification = self.check_message_received(_('"%s" has been updated') % ('test'), self.john['mail'])
self.assertIsInstance(notification, email.message.Message)
- notification_text = str(notification.get_payload());
+ notification_text = str(notification.get_payload())
self.assertNotIn(_("PENDING"), notification_text)
-
def test_008_notify_translated(self):
self.purge_mailbox(self.mark['mailbox'])
- start = datetime.datetime(2014,8,12, 16,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 12, 16, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.mark, attendees=[self.jane])
# send a reply from jane to mark
@@ -952,18 +939,17 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
notification = self.check_message_received(_('"%s" has been updated') % ('test'), self.mark['mail'], self.mark['mailbox'])
self.assertIsInstance(notification, email.message.Message)
- notification_text = str(notification.get_payload());
+ notification_text = str(notification.get_payload())
self.assertIn(self.jane['mail'], notification_text)
self.assertIn(participant_status_label("ACCEPTED")+":", notification_text)
# reset localization
- pykolab.translate.setUserLanguage(conf.get('kolab','default_locale'))
-
+ pykolab.translate.setUserLanguage(conf.get('kolab', 'default_locale'))
def test_009_outdated_reply(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2014,9,2, 11,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 9, 2, 11, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.john, sequence=2)
# send a reply from jane to john
@@ -976,11 +962,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(event.get_sequence(), 2)
self.assertEqual(event.get_attendee(self.jane['mail']).get_participant_status(), kolabformat.PartNeedsAction)
-
def test_010_partstat_update_propagation(self):
# ATTENTION: this test requires wallace.invitationpolicy_autoupdate_other_attendees_on_reply to be enabled in config
- start = datetime.datetime(2014,8,21, 13,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 8, 21, 13, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.john, attendees=[self.jane, self.jack, self.external])
event = self.check_user_calendar_event(self.john['kolabcalendarfolder'], uid)
@@ -1011,7 +996,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(jacks.get_attendee(self.jack['mail']).get_participant_status(), kolabformat.PartTentative)
# PART 2: create conflicting event in jack's calendar
- new_start = datetime.datetime(2014,8,21, 6,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ new_start = datetime.datetime(2014, 8, 21, 6, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
self.create_calendar_event(new_start, user=self.jack, attendees=[], summary="blocker")
# re-schedule initial event to new date
@@ -1033,12 +1018,11 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(jacks.get_attendee(self.jane['mail']).get_participant_status(), kolabformat.PartAccepted)
self.assertEqual(jacks.get_attendee(self.jack['mail']).get_participant_status(), kolabformat.PartNeedsAction)
-
def test_011_manual_schedule_auto_update(self):
self.purge_mailbox(self.john['mailbox'])
# create an event in john's calendar as it was manually accepted
- start = datetime.datetime(2014,9,2, 11,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2014, 9, 2, 11, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.jane, sequence=1, folder=self.john['kolabcalendarfolder'])
# send update with the same sequence: no re-scheduling
@@ -1060,9 +1044,8 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
notification = self.check_message_received(_('"%s" has been updated') % ('old test'), self.jane['mail'], mailbox=self.john['mailbox'])
self.assertEqual(notification, None)
-
def test_012_confidential_invitation(self):
- start = datetime.datetime(2014,9,21, 9,30,0)
+ start = datetime.datetime(2014, 9, 21, 9, 30, 0)
uid = self.send_itip_invitation(self.jane['mail'], start, summary='confidential', template=itip_invitation.replace("DESCRIPTION:test", "CLASS:CONFIDENTIAL"))
# check event being stored in the folder annotared with event.confidential
@@ -1070,10 +1053,9 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertIsInstance(event, pykolab.xml.Event)
self.assertEqual(event.get_summary(), "confidential")
-
def test_013_update_shared_folder(self):
# create an event organized by Mark (a delegate of Jane) into Jane's calendar
- start = datetime.datetime(2015,3,10, 9,30,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ start = datetime.datetime(2015, 3, 10, 9, 30, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_calendar_event(start, user=self.mark, attendees=[self.jane, self.john], folder=self.jane['kolabcalendarfolder'])
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
@@ -1090,28 +1072,27 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
def test_014_per_sender_policy(self):
# send invitation from john => REJECT
- start = datetime.datetime(2015,2,28, 14,0,0)
+ start = datetime.datetime(2015, 2, 28, 14, 0, 0)
uid = self.send_itip_invitation(self.bill['mail'], start)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DECLINED') }, self.bill['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('DECLINED')}, self.bill['mail'])
self.assertIsInstance(response, email.message.Message)
# send invitation from lucy => SAVE
- start = datetime.datetime(2015,3,11, 10,0,0)
+ start = datetime.datetime(2015, 3, 11, 10, 0, 0)
templ = itip_invitation.replace("Doe, John", self.lucy['displayname'])
uid = self.send_itip_invitation(self.bill['mail'], start, template=templ, from_addr=self.lucy['mail'])
event = self.check_user_calendar_event(self.bill['kolabcalendarfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
-
def test_015_update_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,4,2, 14,0,0)
+ start = datetime.datetime(2015, 4, 2, 14, 0, 0)
uid = self.send_itip_invitation(self.jane['mail'], start, template=itip_recurring)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
@@ -1131,14 +1112,13 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(exception.get_summary(), "test exception")
self.assertEqual(exception.get_attendee(self.jane['mail']).get_participant_status(), kolabformat.PartAccepted)
-
def test_015_reschedule_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,4,10, 9,0,0)
+ start = datetime.datetime(2015, 4, 10, 9, 0, 0)
uid = self.send_itip_invitation(self.jane['mail'], start, template=itip_recurring)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
# send update to a single instance with the same sequence: no re-scheduling
@@ -1146,7 +1126,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
exstart = exdate + datetime.timedelta(hours=5)
self.send_itip_update(self.jane['mail'], uid, exstart, summary="test resceduled", sequence=1, partstat='NEEDS-ACTION', instance=exdate)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test resceduled', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test resceduled', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
time.sleep(10)
@@ -1158,7 +1138,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
exstart = exdate + datetime.timedelta(hours=6)
self.send_itip_update(self.jane['mail'], uid, exstart, summary="test new", sequence=2, partstat='NEEDS-ACTION', instance=exdate)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'test new', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'test new', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
# check for updated excaption
@@ -1171,11 +1151,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertIsInstance(exception, pykolab.xml.Event)
self.assertEqual(exception.get_start().strftime('%Y%m%dT%H%M%S'), exstart.strftime('%Y%m%dT%H%M%S'))
-
def test_016_reply_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,3,7, 10,0,0, tzinfo=pytz.timezone("Europe/Zurich"))
+ start = datetime.datetime(2015, 3, 7, 10, 0, 0, tzinfo=pytz.timezone("Europe/Zurich"))
uid = self.create_calendar_event(start, attendees=[self.jane, self.mark], recurring=True)
event = self.check_user_calendar_event(self.john['kolabcalendarfolder'], uid)
@@ -1220,10 +1199,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
def test_017_cancel_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,3,20, 19,0,0, tzinfo=pytz.timezone("Europe/Zurich"))
+ start = datetime.datetime(2015, 3, 20, 19, 0, 0, tzinfo=pytz.timezone("Europe/Zurich"))
uid = self.send_itip_invitation(self.jane['mail'], summary="recurring", start=start, template=itip_recurring)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'recurring', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'recurring', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
event = self.check_user_calendar_event(self.jane['kolabcalendarfolder'], uid)
@@ -1244,13 +1223,13 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
# send a new invitation for the cancelled slot
uid = self.send_itip_invitation(self.jane['mail'], summary="new booking", start=exdate)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'new booking', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'new booking', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
def test_017_cancel_delete_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,3,24, 13,0,0, tzinfo=pytz.timezone("Europe/Zurich"))
+ start = datetime.datetime(2015, 3, 24, 13, 0, 0, tzinfo=pytz.timezone("Europe/Zurich"))
uid = self.send_itip_invitation(self.lucy['mail'], summary="recurring cancel-delete", start=start, template=itip_recurring)
event = self.check_user_calendar_event(self.lucy['kolabcalendarfolder'], uid)
@@ -1281,11 +1260,11 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
def test_017_cancel_thisandfuture(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,5,4, 6,30,0)
+ start = datetime.datetime(2015, 5, 4, 6, 30, 0)
uid = self.send_itip_invitation(self.mark['mail'], summary="recurring", start=start, template=itip_recurring)
pykolab.translate.setUserLanguage(self.mark['preferredlanguage'])
- response = self.check_message_received(_('"%(summary)s" has been %(status)s') % { 'summary':'recurring', 'status':participant_status_label('ACCEPTED') }, self.mark['mail'])
+ response = self.check_message_received(_('"%(summary)s" has been %(status)s') % {'summary': 'recurring', 'status': participant_status_label('ACCEPTED')}, self.mark['mail'])
self.assertIsInstance(response, email.message.Message)
pykolab.translate.setUserLanguage(conf.get('kolab','default_locale'))
@@ -1304,14 +1283,13 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertIsInstance(rrule['until'], datetime.datetime)
self.assertEqual(rrule['until'].strftime('%Y%m%d'), (exdate - datetime.timedelta(days=1)).strftime('%Y%m%d'))
-
def test_018_invite_individual_occurrences(self):
self.purge_mailbox(self.john['mailbox'])
- start = datetime.datetime(2015,1,30, 17,0,0, tzinfo=pytz.timezone("Europe/Zurich"))
+ start = datetime.datetime(2015, 1, 30, 17, 0, 0, tzinfo=pytz.timezone("Europe/Zurich"))
uid = self.send_itip_invitation(self.jane['mail'], summary="single", start=start, instance=start)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'single', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'single', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
self.assertIn("RECURRENCE-ID", str(response))
@@ -1320,10 +1298,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertIsInstance(event.get_recurrence_id(), datetime.datetime)
# send another invitation with the same UID for different RECURRENCE-ID
- newstart = datetime.datetime(2015,2,6, 17,0,0, tzinfo=pytz.timezone("Europe/Zurich"))
+ newstart = datetime.datetime(2015, 2, 6, 17, 0, 0, tzinfo=pytz.timezone("Europe/Zurich"))
self.send_itip_invitation(self.jane['mail'], summary="single #2", uid=uid, start=newstart, instance=newstart)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'single #2', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'single #2', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
self.assertIn("RECURRENCE-ID", str(response))
@@ -1350,12 +1328,11 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
exception = event.get_instance(newstart)
self.assertEqual(exception.get_summary(), "updated #2")
-
def test_020_task_assignment_accept(self):
- start = datetime.datetime(2014,9,10, 19,0,0)
+ start = datetime.datetime(2014, 9, 10, 19, 0, 0)
uid = self.send_itip_invitation(self.jane['mail'], start, summary='work', template=itip_todo)
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'work', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'work', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertIsInstance(response, email.message.Message)
todo = self.check_user_imap_object(self.jane['kolabtasksfolder'], uid, 'task')
@@ -1365,7 +1342,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
# send update with the same sequence: no re-scheduling
self.send_itip_update(self.jane['mail'], uid, start, summary='work updated', template=itip_todo, sequence=0, partstat='ACCEPTED')
- response = self.check_message_received(self.itip_reply_subject % { 'summary':'work updated', 'status':participant_status_label('ACCEPTED') }, self.jane['mail'])
+ response = self.check_message_received(self.itip_reply_subject % {'summary': 'work updated', 'status': participant_status_label('ACCEPTED')}, self.jane['mail'])
self.assertEqual(response, None)
time.sleep(10)
@@ -1374,11 +1351,10 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(todo.get_summary(), "work updated")
self.assertEqual(todo.get_attendee(self.jane['mail']).get_participant_status(), kolabformat.PartAccepted)
-
def test_021_task_assignment_reply(self):
self.purge_mailbox(self.john['mailbox'])
- due = datetime.datetime(2014,9,12, 14,0,0, tzinfo=pytz.timezone("Europe/Berlin"))
+ due = datetime.datetime(2014, 9, 12, 14, 0, 0, tzinfo=pytz.timezone("Europe/Berlin"))
uid = self.create_task_assignment(due, user=self.john)
todo = self.check_user_imap_object(self.john['kolabtasksfolder'], uid, 'task')
@@ -1401,10 +1377,9 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
notification = self.check_message_received(_('"%s" has been updated') % ('test'), self.john['mail'])
self.assertIsInstance(notification, email.message.Message)
- notification_text = str(notification.get_payload());
+ notification_text = str(notification.get_payload())
self.assertIn(participant_status_label(partstat), notification_text)
-
def test_022_task_cancellation(self):
uid = self.send_itip_invitation(self.jane['mail'], summary='more work', template=itip_todo)
@@ -1420,4 +1395,3 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
# this should trigger a notification message
notification = self.check_message_received(_('"%s" has been cancelled') % ('more work'), self.john['mail'], mailbox=self.jane['mailbox'])
self.assertIsInstance(notification, email.message.Message)
-
diff --git a/tests/functional/test_wap_client/__init__.py b/tests/functional/test_wap_client/__init__.py
index d7bf27f..d6cdb57 100644
--- a/tests/functional/test_wap_client/__init__.py
+++ b/tests/functional/test_wap_client/__init__.py
@@ -1,5 +1,6 @@
import pykolab
+
def setup_package():
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
diff --git a/tests/functional/test_wap_client/test_001_connect.py b/tests/functional/test_wap_client/test_001_connect.py
index aa0c069..783d996 100644
--- a/tests/functional/test_wap_client/test_001_connect.py
+++ b/tests/functional/test_wap_client/test_001_connect.py
@@ -3,6 +3,7 @@ import unittest
import pykolab
from pykolab import wap_client
+
class TestConnect(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -18,23 +19,23 @@ class TestConnect(unittest.TestCase):
def test_002_response_ok(self):
result = wap_client.request_raw('POST', 'domains.list')
- self.assertTrue(result.has_key('status'))
- self.assertTrue(result.has_key('result'))
+ self.assertTrue('status' in result)
+ self.assertTrue('result' in result)
self.assertEqual(result['status'], "OK")
def test_003_response_fail(self):
result = wap_client.request_raw('POST', 'service.method')
- self.assertTrue(result.has_key('status'))
- self.assertTrue(result.has_key('reason'))
- self.assertTrue(result.has_key('code'))
+ self.assertTrue('status' in result)
+ self.assertTrue('reason' in result)
+ self.assertTrue('code' in result)
self.assertEqual(result['status'], "ERROR")
self.assertEqual(result['reason'], "Unknown service")
self.assertEqual(result['code'], 400)
def test_004_domains_list(self):
result = wap_client.domains_list()
- self.assertTrue(result.has_key('count'))
- self.assertTrue(result.has_key('list'))
+ self.assertTrue('count' in result)
+ self.assertTrue('list' in result)
self.assertEqual(result['count'], len(result['list']))
def test_005_get_domain(self):
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 96c3de1..771e700 100644
--- a/tests/functional/test_wap_client/test_002_user_add.py
+++ b/tests/functional/test_wap_client/test_002_user_add.py
@@ -8,6 +8,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAdd(unittest.TestCase):
@classmethod
@@ -31,7 +32,6 @@ class TestUserAdd(unittest.TestCase):
purge_users()
def test_001_inbox_created(self):
-
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -67,14 +67,12 @@ class TestUserAdd(unittest.TestCase):
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():
+ if folder_name in ac_folders:
+ if 'annotations' in ac_folders[folder_name]:
+ for _annotation in ac_folders[folder_name]['annotations']:
if _annotation.startswith('/private/'):
continue
_annotation_value = ac_folders[folder_name]['annotations'][_annotation]
- self.assertTrue(metadata[metadata.keys().pop()].has_key(_annotation))
+ self.assertTrue(_annotation in metadata[metadata.keys().pop()])
self.assertEqual(_annotation_value, metadata[metadata.keys().pop()][_annotation])
-
-
diff --git a/tests/functional/test_wap_client/test_003_user_add_fr_FR.py b/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
index b9ef510..72cf84b 100644
--- a/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
+++ b/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
@@ -10,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAddFrFR(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -32,7 +33,6 @@ class TestUserAddFrFR(unittest.TestCase):
purge_users()
def test_001_inbox_created(self):
-
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -54,5 +54,3 @@ class TestUserAddFrFR(unittest.TestCase):
self.assertEqual(result['mail'], 'etienne-nicolas.mehul@example.org')
self.assertEqual(sorted(result['alias']), ['e.mehul@example.org', 'mehul@example.org'])
-
-
diff --git a/tests/functional/test_wap_client/test_004_user_add_es_ES.py b/tests/functional/test_wap_client/test_004_user_add_es_ES.py
index a681a2d..7fc5d83 100644
--- a/tests/functional/test_wap_client/test_004_user_add_es_ES.py
+++ b/tests/functional/test_wap_client/test_004_user_add_es_ES.py
@@ -10,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAddEsES(unittest.TestCase):
@classmethod
@@ -33,7 +34,6 @@ class TestUserAddEsES(unittest.TestCase):
purge_users()
def test_001_inbox_created(self):
-
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -54,5 +54,3 @@ class TestUserAddEsES(unittest.TestCase):
self.assertEqual(result['mail'], 'alvaro.fuentes@example.org')
self.assertEqual(sorted(result['alias']), ['a.fuentes@example.org', 'fuentes@example.org'])
-
-
diff --git a/tests/functional/test_wap_client/test_005_user_add_de_CH.py b/tests/functional/test_wap_client/test_005_user_add_de_CH.py
index dd38383..c2d22c6 100644
--- a/tests/functional/test_wap_client/test_005_user_add_de_CH.py
+++ b/tests/functional/test_wap_client/test_005_user_add_de_CH.py
@@ -10,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAddDeCH(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -53,5 +54,3 @@ class TestUserAddDeCH(unittest.TestCase):
self.assertEqual(result['mail'], 'thomas.bruederli@example.org')
self.assertEqual(sorted(result['alias']), ['bruederli@example.org', 't.bruederli@example.org'])
-
-
diff --git a/tests/functional/test_wap_client/test_006_form_value_select_options.py b/tests/functional/test_wap_client/test_006_form_value_select_options.py
index 92b4992..0f2bbdd 100644
--- a/tests/functional/test_wap_client/test_006_form_value_select_options.py
+++ b/tests/functional/test_wap_client/test_006_form_value_select_options.py
@@ -6,6 +6,7 @@ from pykolab import wap_client
conf = pykolab.getConf()
+
class TestFormValueListOptions(unittest.TestCase):
def test_001_list_options_user_preferredlanguage(self):
@@ -24,8 +25,7 @@ class TestFormValueListOptions(unittest.TestCase):
'preferredlanguage'
)
- self.assertTrue(attribute_values['preferredlanguage'].has_key('default'))
- self.assertTrue(attribute_values['preferredlanguage'].has_key('list'))
+ self.assertTrue('default' in attribute_values['preferredlanguage'])
+ self.assertTrue('list' in attribute_values['preferredlanguage'])
self.assertTrue(len(attribute_values['preferredlanguage']['list']) > 1)
self.assertTrue(attribute_values['preferredlanguage']['default'] in attribute_values['preferredlanguage']['list'])
-
diff --git a/tests/functional/test_wap_client/test_007_policy_uid.py b/tests/functional/test_wap_client/test_007_policy_uid.py
index 534ebda..a10eeb9 100644
--- a/tests/functional/test_wap_client/test_007_policy_uid.py
+++ b/tests/functional/test_wap_client/test_007_policy_uid.py
@@ -9,6 +9,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestPolicyUid(unittest.TestCase):
def remove_option(self, section, option):
@@ -172,5 +173,3 @@ class TestPolicyUid(unittest.TestCase):
from tests.functional.purge_users import purge_users
purge_users()
-
-
diff --git a/tests/functional/test_wap_client/test_008_resource_add.py b/tests/functional/test_wap_client/test_008_resource_add.py
index 5647d0c..f4b4c20 100644
--- a/tests/functional/test_wap_client/test_008_resource_add.py
+++ b/tests/functional/test_wap_client/test_008_resource_add.py
@@ -10,6 +10,7 @@ import tests.functional.resource_func as funcs
conf = pykolab.getConf()
+
class TestResourceAdd(unittest.TestCase):
@classmethod
@@ -29,7 +30,7 @@ class TestResourceAdd(unittest.TestCase):
self.audi = funcs.resource_add("car", "Audi A4")
self.passat = funcs.resource_add("car", "VW Passat")
self.boxter = funcs.resource_add("car", "Porsche Boxter S")
- self.cars = funcs.resource_add("collection", "Company Cars", [ self.audi['dn'], self.passat['dn'], self.boxter['dn'] ])
+ self.cars = funcs.resource_add("collection", "Company Cars", [self.audi['dn'], self.passat['dn'], self.boxter['dn']])
from tests.functional.synchronize import synchronize_once
synchronize_once()
diff --git a/tests/functional/user_add.py b/tests/functional/user_add.py
index b1b37f1..35e2b6b 100644
--- a/tests/functional/user_add.py
+++ b/tests/functional/user_add.py
@@ -4,17 +4,12 @@ from pykolab import wap_client
conf = pykolab.getConf()
-def user_add(givenname, sn, preferredlanguage='en_US', **kw):
- if givenname == None:
- raise Exception
-
- if givenname == '':
- raise Exception
- if sn == None:
+def user_add(givenname, sn, preferredlanguage='en_US', **kw):
+ if givenname is None or givenname == '':
raise Exception
- if sn == '':
+ if sn is None or sn == '':
raise Exception
user_details = {
@@ -51,7 +46,7 @@ def user_add(givenname, sn, preferredlanguage='en_US', **kw):
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 or user_details.has_key(attribute):
+ if 'optional' not in attr_details or attr_details['optional'] is False or attribute in user_details:
params[attribute] = user_details[attribute]
elif isinstance(attr_details, list):
params[attribute] = user_details[attribute]
@@ -59,7 +54,6 @@ def user_add(givenname, sn, preferredlanguage='en_US', **kw):
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()]
+ fvg_params['attributes'] = [attr for attr in user_type_info['auto_form_fields'].keys() if attr not in params]
result = wap_client.user_add(params)
-