summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_wallace/test_007_invitationpolicy.py39
-rw-r--r--tests/unit/test-012-wallace_invitationpolicy.py5
2 files changed, 40 insertions, 4 deletions
diff --git a/tests/functional/test_wallace/test_007_invitationpolicy.py b/tests/functional/test_wallace/test_007_invitationpolicy.py
index 090dcf3..cca5b96 100644
--- a/tests/functional/test_wallace/test_007_invitationpolicy.py
+++ b/tests/functional/test_wallace/test_007_invitationpolicy.py
@@ -299,6 +299,17 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'kolabinvitationpolicy': ['ALL_SAVE_AND_FORWARD','ACT_UPDATE_AND_NOTIFY']
}
+ self.bill = {
+ 'displayname': 'Bill Mayor',
+ 'mail': 'bill.mayor@example.org',
+ 'dn': 'uid=mayor,ou=People,dc=example,dc=org',
+ 'preferredlanguage': 'en_US',
+ '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']
+ }
+
self.external = {
'displayname': 'Bob External',
'mail': 'bob.external@gmail.com'
@@ -310,6 +321,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
user_add("Jack", "Tentative", kolabinvitationpolicy=self.jack['kolabinvitationpolicy'], preferredlanguage=self.jack['preferredlanguage'])
user_add("Mark", "German", kolabinvitationpolicy=self.mark['kolabinvitationpolicy'], preferredlanguage=self.mark['preferredlanguage'])
user_add("Lucy", "Meyer", kolabinvitationpolicy=self.lucy['kolabinvitationpolicy'], preferredlanguage=self.lucy['preferredlanguage'])
+ user_add("Bill", "Mayor", kolabinvitationpolicy=self.bill['kolabinvitationpolicy'], preferredlanguage=self.bill['preferredlanguage'])
time.sleep(1)
from tests.functional.synchronize import synchronize_once
@@ -339,7 +351,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
smtp = smtplib.SMTP('localhost', 10026)
smtp.sendmail(from_addr, to_addr, mime_message % (to_addr, method, itip_payload))
- def send_itip_invitation(self, attendee_email, start=None, allday=False, template=None, summary="test", sequence=0, partstat='NEEDS-ACTION'):
+ def send_itip_invitation(self, attendee_email, start=None, allday=False, template=None, summary="test", sequence=0, partstat='NEEDS-ACTION', from_addr=None):
if start is None:
start = datetime.datetime.now()
@@ -354,6 +366,12 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
default_template = itip_invitation
date_format = '%Y%m%dT%H%M%S'
+ if from_addr is not None:
+ if template:
+ template = template.replace("john.doe@example.org", from_addr)
+ else:
+ default_template = default_template.replace("john.doe@example.org", from_addr)
+
self.send_message((template if template is not None else default_template) % {
'uid': uid,
'start': start.strftime(date_format),
@@ -363,7 +381,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
'sequence': sequence,
'partstat': partstat
},
- attendee_email)
+ attendee_email, from_addr=from_addr)
return uid
@@ -671,6 +689,7 @@ 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'])
@@ -1010,6 +1029,22 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertIsInstance(event, pykolab.xml.Event)
self.assertEqual(event.get_attendee(self.john['mail']).get_participant_status(), kolabformat.PartAccepted)
+ def test_014_per_sender_policy(self):
+ # send invitation from john => REJECT
+ 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'])
+ self.assertIsInstance(response, email.message.Message)
+
+ # send invitation from lucy => SAVE
+ 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_020_task_assignment_accept(self):
start = datetime.datetime(2014,9,10, 19,0,0)
diff --git a/tests/unit/test-012-wallace_invitationpolicy.py b/tests/unit/test-012-wallace_invitationpolicy.py
index f51b93e..b612a52 100644
--- a/tests/unit/test-012-wallace_invitationpolicy.py
+++ b/tests/unit/test-012-wallace_invitationpolicy.py
@@ -130,8 +130,9 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(MIP.get_matching_invitation_policies(user, 'c@gmail.com', MIP.COND_TYPE_EVENT), [MIP.ACT_REJECT, MIP.ACT_MANUAL])
self.assertEqual(MIP.get_matching_invitation_policies(user, 'd@somedomain.net', MIP.COND_TYPE_TASK), [MIP.ACT_REJECT, MIP.ACT_MANUAL])
- user = { 'kolabinvitationpolicy': ['ACT_ACCEPT:example.org', 'ACT_MANUAL:others'] }
- self.assertEqual(MIP.get_matching_invitation_policies(user, 'd@somedomain.net', MIP.COND_TYPE_ALL), [MIP.ACT_MANUAL])
+ user = { 'kolabinvitationpolicy': ['ALL_SAVE_TO_FOLDER:maya.foo@example.org', 'ACT_REJECT:others'] }
+ self.assertEqual(MIP.get_matching_invitation_policies(user, 'maya.foo@example.org', MIP.COND_TYPE_ALL), [MIP.ACT_SAVE_TO_FOLDER])
+ self.assertEqual(MIP.get_matching_invitation_policies(user, 'd@somedomain.net', MIP.COND_TYPE_ALL), [MIP.ACT_MANUAL])
def test_004_write_locks(self):
user = { 'cn': 'John Doe', 'mail': "doe@example.org" }