예제 #1
0
 def testCompact(self):
     from MaKaC.schedule import TimeSchedule
     sDateSch = datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
     eDateSch = datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC'))
     schOwner = _ScheduleOwnerWrapper(sDateSch, eDateSch)
     sch = TimeSchedule(schOwner)
     from MaKaC.schedule import TimeSchEntry
     entry1, entry2 = IndTimeSchEntry(), IndTimeSchEntry()
     entry3 = IndTimeSchEntry()
     entry1.setDuration(0, 25)
     entry2.setDuration(0, 25)
     entry3.setDuration(0, 30)
     sch.addEntry(entry1)
     self.assert_(entry1.getStartDate() == datetime(
         2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
예제 #2
0
 def testMoveDown(self):
     from MaKaC.schedule import ConferenceSchedule
     sDateSch = datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
     eDateSch = datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC'))
     self._conf.setStartDate(sDateSch)
     self._conf.setEndDate(eDateSch)
     sch = ConferenceSchedule(self._conf)
     from MaKaC.schedule import TimeSchEntry
     entry1, entry2 = IndTimeSchEntry(), IndTimeSchEntry()
     entry3 = IndTimeSchEntry()
     entry1.setDuration(0, 25)
     entry2.setDuration(0, 25)
     entry3.setDuration(0, 30)
     sch.addEntry(entry1)
     self.assert_(entry1.getStartDate() == datetime(
         2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
예제 #3
0
 def testCompact(self):
     from MaKaC.schedule import TimeSchedule
     sDateSch=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
     eDateSch=datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC'))
     schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
     sch=TimeSchedule(schOwner)
     from MaKaC.schedule import TimeSchEntry
     entry1,entry2=IndTimeSchEntry(),IndTimeSchEntry()
     entry3=IndTimeSchEntry()
     entry1.setDuration(0,25)
     entry2.setDuration(0,25)
     entry3.setDuration(0,30)
     sch.addEntry(entry1)
     self.assert_(entry1.getStartDate()==datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
예제 #4
0
 def testMoveDown(self):
     from MaKaC.schedule import ConferenceSchedule
     sDateSch=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
     eDateSch=datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC'))
     self._conf.setStartDate(sDateSch)
     self._conf.setEndDate(eDateSch)
     sch=ConferenceSchedule(self._conf)
     from MaKaC.schedule import TimeSchEntry
     entry1,entry2=IndTimeSchEntry(),IndTimeSchEntry()
     entry3=IndTimeSchEntry()
     entry1.setDuration(0,25)
     entry2.setDuration(0,25)
     entry3.setDuration(0,30)
     sch.addEntry(entry1)
     self.assert_(entry1.getStartDate()==datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
예제 #5
0
 def testBasicAddAndRemove(self):
     from MaKaC.schedule import TimeSchedule
     sDateSch, eDateSch = datetime(2004,
                                   1,
                                   1,
                                   10,
                                   0,
                                   tzinfo=timezone('UTC')), datetime(
                                       2004,
                                       1,
                                       1,
                                       12,
                                       0,
                                       tzinfo=timezone('UTC'))
     schOwner = _ScheduleOwnerWrapper(sDateSch, eDateSch)
     sch = TimeSchedule(schOwner)
     entry1 = IndTimeSchEntry()
     entry1.setDuration(0, 25)
     entry2 = IndTimeSchEntry()
     entry2.setDuration(0, 30)
     entry3 = IndTimeSchEntry()
     self.assert_(not entry1.isScheduled())
     self.assert_(not entry2.isScheduled())
     self.assert_(not entry3.isScheduled())
     sch.addEntry(entry1)
     sch.addEntry(entry2)
     sch.addEntry(entry3)
     self.assert_(entry1.isScheduled())
     self.assert_(entry2.isScheduled())
     self.assert_(entry3.isScheduled())
     self.assert_(entry1 == sch.getEntries()[0])
     self.assert_(entry2 == sch.getEntries()[1])
     self.assert_(entry3 == sch.getEntries()[2])
     self.assert_(entry1.getStartDate() == datetime(
         2004, 1, 1, 10, 0, tzinfo=timezone('UTC')))
     self.assert_(entry1.getDuration() == timedelta(minutes=25))
     self.assert_(entry2.getStartDate() == datetime(
         2004, 1, 1, 10, 25, tzinfo=timezone('UTC')))
     self.assert_(entry2.getDuration() == timedelta(minutes=30))
     self.assert_(entry3.getStartDate() == datetime(
         2004, 1, 1, 10, 55, tzinfo=timezone('UTC')))
     self.assert_(entry3.getDuration() == timedelta(minutes=5))
     sch.removeEntry(entry1)
     self.assert_(not entry1.isScheduled())
     self.assert_(entry2.isScheduled())
     self.assert_(entry3.isScheduled())
     self.assert_(entry1 not in sch.getEntries())
     self.assert_(entry2 == sch.getEntries()[0])
     self.assert_(entry3 == sch.getEntries()[1])
     self.assert_(entry1.getDuration() == timedelta(minutes=25))
     self.assert_(entry2.getStartDate() == datetime(
         2004, 1, 1, 10, 25, tzinfo=timezone('UTC')))
     self.assert_(entry2.getDuration() == timedelta(minutes=30))
     self.assert_(entry3.getStartDate() == datetime(
         2004, 1, 1, 10, 55, tzinfo=timezone('UTC')))
     self.assert_(entry3.getDuration() == timedelta(minutes=5))
예제 #6
0
 def testBasicAddAndRemove( self ):
     from MaKaC.schedule import TimeSchedule
     sDateSch,eDateSch=datetime(2004,1,1,10,0, tzinfo=timezone('UTC')),datetime(2004,1,1,12,0, tzinfo=timezone('UTC'))
     schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
     sch=TimeSchedule(schOwner)
     entry1=IndTimeSchEntry()
     entry1.setDuration(0,25)
     entry2=IndTimeSchEntry()
     entry2.setDuration(0,30)
     entry3=IndTimeSchEntry()
     self.assert_(not entry1.isScheduled())
     self.assert_(not entry2.isScheduled())
     self.assert_(not entry3.isScheduled())
     sch.addEntry(entry1)
     sch.addEntry(entry2)
     sch.addEntry(entry3)
     self.assert_(entry1.isScheduled())
     self.assert_(entry2.isScheduled())
     self.assert_(entry3.isScheduled())
     self.assert_(entry1==sch.getEntries()[0])
     self.assert_(entry2==sch.getEntries()[1])
     self.assert_(entry3==sch.getEntries()[2])
     self.assert_(entry1.getStartDate()==datetime(2004,1,1,10,0, tzinfo=timezone('UTC')))
     self.assert_(entry1.getDuration()==timedelta(minutes=25))
     self.assert_(entry2.getStartDate()==datetime(2004,1,1,10,25, tzinfo=timezone('UTC')))
     self.assert_(entry2.getDuration()==timedelta(minutes=30))
     self.assert_(entry3.getStartDate()==datetime(2004,1,1,10,55, tzinfo=timezone('UTC')))
     self.assert_(entry3.getDuration()==timedelta(minutes=5))
     sch.removeEntry(entry1)
     self.assert_(not entry1.isScheduled())
     self.assert_(entry2.isScheduled())
     self.assert_(entry3.isScheduled())
     self.assert_(entry1 not in sch.getEntries())
     self.assert_(entry2==sch.getEntries()[0])
     self.assert_(entry3==sch.getEntries()[1])
     self.assert_(entry1.getDuration()==timedelta(minutes=25))
     self.assert_(entry2.getStartDate()==datetime(2004,1,1,10,25, tzinfo=timezone('UTC')))
     self.assert_(entry2.getDuration()==timedelta(minutes=30))
     self.assert_(entry3.getStartDate()==datetime(2004,1,1,10,55, tzinfo=timezone('UTC')))
     self.assert_(entry3.getDuration()==timedelta(minutes=5))