summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-011-wallace_resources.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-03-19 18:49:44 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-03-19 18:49:44 -0400
commit53e46b7870e48d0a76a997737d4c7df53dee3bd8 (patch)
treeffae0315d27b93f093582ecb0402a40e985a54d6 /tests/unit/test-011-wallace_resources.py
parente9634cff74a53a653b2581b771e0b8a7cafe02ec (diff)
downloadpykolab-53e46b7870e48d0a76a997737d4c7df53dee3bd8.tar.gz
Add unit tests for wallace module_resources.check_date_conflict; fix invalid iTip block
Diffstat (limited to 'tests/unit/test-011-wallace_resources.py')
-rw-r--r--tests/unit/test-011-wallace_resources.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/unit/test-011-wallace_resources.py b/tests/unit/test-011-wallace_resources.py
index 6198a6f..8b01874 100644
--- a/tests/unit/test-011-wallace_resources.py
+++ b/tests/unit/test-011-wallace_resources.py
@@ -1,5 +1,6 @@
import pykolab
import logging
+import datetime
from icalendar import Calendar
from email import message
@@ -47,7 +48,7 @@ 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=
+ATTENDEE;ROLE=3DOPT-PARTICIPANT;PARTSTAT=3DNEEDS-ACTION;RSVP=3DTRUE:mailto:anoth=
er-resource@example.org
TRANSP:OPAQUE
END:VEVENT
@@ -396,3 +397,31 @@ class TestWallaceResources(unittest.TestCase):
self.assertEqual(ical2['attendee'], "MAILTO:resource-collection-car@example.org")
self.assertEqual(ical2['attendee'].params['PARTSTAT'], "DELEGATED")
+
+ def test_007_check_date_conflict(self):
+ astart = datetime.datetime(2014,7,13, 10,0,0)
+ aend = astart + datetime.timedelta(hours=2)
+
+ bstart = datetime.datetime(2014,7,13, 10,0,0)
+ bend = astart + datetime.timedelta(hours=1)
+ self.assertTrue(module_resources.check_date_conflict(astart, aend, bstart, bend))
+
+ bstart = datetime.datetime(2014,7,13, 11,0,0)
+ bend = astart + datetime.timedelta(minutes=30)
+ self.assertTrue(module_resources.check_date_conflict(astart, aend, bstart, bend))
+
+ bend = astart + datetime.timedelta(hours=2)
+ self.assertTrue(module_resources.check_date_conflict(astart, aend, bstart, bend))
+
+ bstart = datetime.datetime(2014,7,13, 12,0,0)
+ bend = astart + datetime.timedelta(hours=1)
+ self.assertFalse(module_resources.check_date_conflict(astart, aend, bstart, bend))
+
+ bstart = datetime.datetime(2014,6,13, 10,0,0)
+ bend = datetime.datetime(2014,6,14, 12,0,0)
+ self.assertFalse(module_resources.check_date_conflict(astart, aend, bstart, bend))
+
+ bstart = datetime.datetime(2014,7,10, 12,0,0)
+ bend = datetime.datetime(2014,7,14, 14,0,0)
+ self.assertTrue(module_resources.check_date_conflict(astart, aend, bstart, bend))
+