summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-011-wallace_resources.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-02-19 17:54:03 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-02-19 17:54:03 -0500
commit66baddf10c099c8b0c287c267e58afeec387d520 (patch)
treefc0b921858574f9e3f7beacbe2075cb1d3bf970c /tests/unit/test-011-wallace_resources.py
parente6deec8a14428b9550c38ba09338c8222ed9035c (diff)
downloadpykolab-66baddf10c099c8b0c287c267e58afeec387d520.tar.gz
Refactored wallace/module_resource:
- moved functional blocks into actual functions for better testing - limit processing to the resource that received the given message (each resource will receive this invitation and respond individually) - simplified the code, reduced duplication
Diffstat (limited to 'tests/unit/test-011-wallace_resources.py')
-rw-r--r--tests/unit/test-011-wallace_resources.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/unit/test-011-wallace_resources.py b/tests/unit/test-011-wallace_resources.py
index 106c2f3..f6b2d40 100644
--- a/tests/unit/test-011-wallace_resources.py
+++ b/tests/unit/test-011-wallace_resources.py
@@ -47,6 +47,8 @@ DESCRIPTION:test
ORGANIZER;CN=3D"Doe, John":mailto:john.doe@example.org
ATTENDEE;ROLE=3DREQ-PARTICIPANT;PARTSTAT=3DNEEDS-ACTION;RSVP=3DTRUE:mailt=
o:resource-collection-car@example.org
+ATTENDEE;ROLE=3DOPTIONAL;PARTSTAT=3DNEEDS-ACTION;RSVP=3DTRUE:mailto:anoth=
+er-resource@example.org
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
@@ -305,15 +307,20 @@ class TestWallaceResources(unittest.TestCase):
def test_002_resource_record_from_email_address(self):
res = module_resources.resource_record_from_email_address("doe@example.org")
- # assert call to (pathced) pykolab.auth.Auth.find_resource()
+ # assert call to (patched) pykolab.auth.Auth.find_resource()
self.assertEqual(len(res), 1);
self.assertEqual("uid=doe,dc=example,dc=org", res[0]);
def test_003_resource_records_from_itip_events(self):
- itips = module_resources.itip_events_from_message(message_from_string(itip_multipart))
+ message = message_from_string(itip_multipart)
+ itips = module_resources.itip_events_from_message(message)
+
res = module_resources.resource_records_from_itip_events(itips)
- self.assertEqual(len(res), 1);
+ self.assertEqual(len(res), 2, "Return all attendee resources");
+
+ res = module_resources.resource_records_from_itip_events(itips, message['To'])
+ self.assertEqual(len(res), 1, "Return only recipient resource");
self.assertEqual("uid=resource-collection-car,dc=example,dc=org", res[0]);