Commit 930cef10 authored by Jérome Perrin's avatar Jérome Perrin

calendar: make sure calendar is re-indexed when exception is deleted

Also rename the test to be more specific and remove useless
organisation.
parent 5a134b23
......@@ -57,6 +57,8 @@
<value>
<list>
<string>_set.*</string>
<string>manage_delObjects</string>
<string>deleteContent</string>
</list>
</value>
</item>
......
......@@ -856,10 +856,7 @@ class TestCalendar(ERP5ReportTestCase):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_CalendarException(self):
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation')
def test_CalendarExceptionInGroupCalendar(self):
group_calendar = self.portal.group_calendar_module.newContent(
portal_type='Group Calendar')
group_calendar_period = group_calendar.newContent(
......@@ -872,9 +869,7 @@ class TestCalendar(ERP5ReportTestCase):
person1 = self.portal.person_module.newContent(
portal_type='Person',
title='Person 1',
career_reference='1',
subordination_value=organisation)
title='Person 1',)
self.tic()
self.assertEqual([0], [x.total_quantity
for x in person1.getAvailableTimeSequence(
......@@ -913,6 +908,24 @@ class TestCalendar(ERP5ReportTestCase):
to_date=DateTime(2008, 1, 1).latestTime(),
day=1)])
# "undo" for the rest of the test
exception.setExceptionDate(DateTime(2008, 1, 1))
self.tic()
self.assertEqual([0], [x.total_quantity
for x in person1.getAvailableTimeSequence(
from_date=DateTime(2008, 1, 1).earliestTime(),
to_date=DateTime(2008, 1, 1).latestTime(),
day=1)])
# When calendar exception is deleted, assigments are also automatically updated.
group_calendar_period.manage_delObjects(ids=[exception.getId()])
self.tic()
self.assertEqual([36000], [x.total_quantity
for x in person1.getAvailableTimeSequence(
from_date=DateTime(2008, 1, 1).earliestTime(),
to_date=DateTime(2008, 1, 1).latestTime(),
day=1)])
def test_GroupCalendarConstraint(self):
group_calendar = self.portal.group_calendar_module.newContent(
portal_type='Group Calendar')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment