Commit bb77f758 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 5b251c47
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
<value> <value>
<list> <list>
<string>_set.*</string> <string>_set.*</string>
<string>manage_delObjects</string>
<string>deleteContent</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -856,10 +856,7 @@ class TestCalendar(ERP5ReportTestCase): ...@@ -856,10 +856,7 @@ class TestCalendar(ERP5ReportTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_CalendarException(self): def test_CalendarExceptionInGroupCalendar(self):
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation')
group_calendar = self.portal.group_calendar_module.newContent( group_calendar = self.portal.group_calendar_module.newContent(
portal_type='Group Calendar') portal_type='Group Calendar')
group_calendar_period = group_calendar.newContent( group_calendar_period = group_calendar.newContent(
...@@ -872,9 +869,7 @@ class TestCalendar(ERP5ReportTestCase): ...@@ -872,9 +869,7 @@ class TestCalendar(ERP5ReportTestCase):
person1 = self.portal.person_module.newContent( person1 = self.portal.person_module.newContent(
portal_type='Person', portal_type='Person',
title='Person 1', title='Person 1',)
career_reference='1',
subordination_value=organisation)
self.tic() self.tic()
self.assertEqual([0], [x.total_quantity self.assertEqual([0], [x.total_quantity
for x in person1.getAvailableTimeSequence( for x in person1.getAvailableTimeSequence(
...@@ -913,6 +908,24 @@ class TestCalendar(ERP5ReportTestCase): ...@@ -913,6 +908,24 @@ class TestCalendar(ERP5ReportTestCase):
to_date=DateTime(2008, 1, 1).latestTime(), to_date=DateTime(2008, 1, 1).latestTime(),
day=1)]) 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): def test_GroupCalendarConstraint(self):
group_calendar = self.portal.group_calendar_module.newContent( group_calendar = self.portal.group_calendar_module.newContent(
portal_type='Group Calendar') 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