Пример #1
0
 def testTypeSetUp(self):
     #test setting up the schedule type of a session works correctly
     self._conf.setDates(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')),datetime(2004,1,5,10,0,tzinfo=timezone('UTC')))
     session=Session()
     session.setStartDate(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
     session.setDuration(hours=10,minutes=0)
     self._conf.addSession(session)
     slot1=SessionSlot(session)
     session.addSlot(slot1)
     c1,c2,c3=Contribution(),Contribution(),Contribution()
     session.addContribution(c1)
     session.addContribution(c2)
     session.addContribution(c3)
     slot1.getSchedule().addEntry(c1.getSchEntry())
     slot1.getSchedule().addEntry(c2.getSchEntry())
     slot1.getSchedule().addEntry(c3.getSchEntry())
     self.assert_(c1.getSchEntry()==slot1.getSchedule().getEntries()[0])
     self.assert_(c2.getSchEntry()==slot1.getSchedule().getEntries()[1])
     self.assert_(c3.getSchEntry()==slot1.getSchedule().getEntries()[2])
     self.assert_(session.getScheduleType()=="standard")
     self.assert_(slot1.getSchedule().__class__==conference.SlotSchedule)
     session.setScheduleType("poster")
     self.assert_(session.getScheduleType()=="poster")
     self.assert_(slot1.getSchedule().__class__==conference.PosterSlotSchedule)
     self.assert_(len(slot1.getSchedule().getEntries())==0)
Пример #2
0
 def testMoveScheduledContribToSession(self):
     #tests that moving scheduled contributions at conference level into a 
     #   session works correctly: removes them from the conference schedule
     #   and includes them into the selected session
     self._conf.setDates(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')),datetime(2004,1,5,10,0,tzinfo=timezone('UTC')))
     session1=Session()
     session1.setStartDate(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
     session1.setDuration(hours=1,minutes=0)
     self._conf.addSession(session1)
     c1,c2=Contribution(),Contribution()
     self._conf.addContribution(c1)
     self._conf.addContribution(c2)
     self._conf.getSchedule().addEntry(c1.getSchEntry())
     self._conf.getSchedule().addEntry(c2.getSchEntry())
     self.assert_(c1.isScheduled())
     self.assert_(c2.isScheduled())
     session1.addContribution(c1)
     self.assert_(not c1.isScheduled())
     self.assert_(c2.isScheduled())
Пример #3
0
 def testContributions(self):
     self._conf.setDates(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')),datetime(2004,1,5,10,0,tzinfo=timezone('UTC')))
     from MaKaC.conference import Session,Contribution,SessionSlot
     self._conf.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
     self._conf.setEndDate(datetime(2005,1,1,10,0,tzinfo=timezone('UTC')))
     session1=Session()
     self._conf.addSession(session1)
     session1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
     session1.setDuration(hours=5,minutes=0)
     slot1=SessionSlot(session1)
     slot1.setDuration(hours=2,minutes=0)
     session1.addSlot(slot1)
     slot2=SessionSlot(session1)
     slot2.setDuration(hours=2,minutes=0)
     session1.addSlot(slot2)
     self.assert_(slot2.getStartDate()==datetime(2004,1,1,12,0,tzinfo=timezone('UTC')))
     c1,c2,c3=Contribution(),Contribution(),Contribution()
     session1.addContribution(c1)
     session1.addContribution(c2)
     session1.addContribution(c3)
     c1.setDuration(0,30)
     c2.setDuration(0,30)
     c3.setDuration(0,30)
     from MaKaC.errors import MaKaCError
     #self.assertRaises(MaKaCError,slot1.getSchedule().addEntry,c1.getSchEntry())
     slot1.getSchedule().addEntry(c1.getSchEntry())
     slot1.getSchedule().addEntry(c2.getSchEntry())
     slot1.getSchedule().addEntry(c3.getSchEntry())
     self.assert_(c1.getStartDate()==datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
     self.assert_(c2.getStartDate()==datetime(2004,1,1,10,30,tzinfo=timezone('UTC')))
     self.assert_(c3.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
     #slot2.getSchedule().addEntry(c1.getSchEntry())
     #self.assert_(c1.getStartDate()==datetime(2004,1,1,12,0,tzinfo=timezone('UTC')))
     #self.assert_(c2.getStartDate()==datetime(2004,1,1,10,30,tzinfo=timezone('UTC')))
     #self.assert_(c3.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
     from MaKaC.schedule import BreakTimeSchEntry
     b1=BreakTimeSchEntry()
     slot1.getSchedule().addEntry(b1)
     self.assert_(b1 in slot1.getSchedule().getEntries())
Пример #4
0
 def testSlots(self):
     self._conf.setDates(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')),datetime(2004,1,5,10,0,tzinfo=timezone('UTC')))
     session1=Session()
     session1.setStartDate(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
     session1.setDuration(hours=10,minutes=0)
     self._conf.addSession(session1)
     slot1=SessionSlot(session1)
     slot1.setDuration(hours=2,minutes=0)
     session1.addSlot(slot1)
     self.assert_(slot1.getSessionSchEntry() in session1.getSchedule().getEntries())
     self.assert_(slot1.getStartDate()==session1.getStartDate())
     self.assert_(slot1.getDuration().seconds==7200)
     slot2=SessionSlot(session1)
     slot2.setDuration(hours=2,minutes=0)
     session1.addSlot(slot2)
     self.assert_(slot1.getSessionSchEntry()==session1.getSchedule().getEntries()[0])
     self.assert_(slot1.getStartDate()==session1.getStartDate())
     self.assert_(slot1.getDuration().seconds==7200)
     self.assert_(slot2.getSessionSchEntry()==session1.getSchedule().getEntries()[1])
     self.assert_(slot2.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
     self.assert_(slot2.getDuration().seconds==7200)
     slot2.setStartDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
     self.assert_(slot1.getSessionSchEntry()==session1.getSchedule().getEntries()[0])
     self.assert_(slot1.getStartDate()==session1.getStartDate())
     self.assert_(slot1.getDuration().seconds==7200)
     self.assert_(slot2.getSessionSchEntry()==session1.getSchedule().getEntries()[1])
     self.assert_(slot2.getStartDate()==datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
     self.assert_(slot2.getDuration().seconds==7200)
     slot1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
     slot2.setStartDate(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
     self.assert_(slot2.getStartDate()==datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
     #slot1.setStartDate(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
     #slot2.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
     self.assert_(slot1.getSessionSchEntry()==session1.getSchedule().getEntries()[1])
     self.assert_(slot1.getDuration().seconds==7200)
     self.assert_(slot2.getSessionSchEntry()==session1.getSchedule().getEntries()[0])
     self.assert_(slot2.getStartDate()==datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
     self.assert_(slot2.getDuration().seconds==7200)