Example #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)
Example #2
0
class TestPosterSchedule(unittest.TestCase):
    """Tests the schedule for posters like schedules management functions
    """

    def setUp( self ):
        a=Avatar()
        a.setId("creator")
        self._conf=Conference(a)
        self._conf.setTimezone('UTC')
        self._conf.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
        self._conf.setEndDate(datetime(2004,1,1,13,0,tzinfo=timezone('UTC')))
        self._session=Session()
        self._session.setStartDate(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
        self._session.setEndDate(datetime(2004,1,1,13,0,tzinfo=timezone('UTC')))
        self._conf.addSession(self._session)
        self._slot1=SessionSlot(self._session)
        self._slot1.setStartDate(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
        self._slot1.setDuration(hours=1)
        self._session.addSlot(self._slot1)
        self._session.setScheduleType("poster")
        self._session.setContribDuration(1,0)

    def testBasic(self):
        #tests the basic adding of entries to a poster like timetable
        p1,p2,p3=Contribution(),Contribution(),Contribution()
        self._session.addContribution(p1)
        self._session.addContribution(p2)
        self._session.addContribution(p3)
        self._slot1.getSchedule().addEntry(p1.getSchEntry())
        self._slot1.getSchedule().addEntry(p2.getSchEntry())
        self._slot1.getSchedule().addEntry(p3.getSchEntry())
        self.assert_(p1.getDuration()==self._session.getContribDuration())
        self.assert_(p2.getDuration()==self._session.getContribDuration())
        self.assert_(p3.getDuration()==self._session.getContribDuration())
        self.assert_(p1.getStartDate()==self._slot1.getStartDate())
        self.assert_(p2.getStartDate()==self._slot1.getStartDate())
        self.assert_(p3.getStartDate()==self._slot1.getStartDate())
        self.assert_(p1.getSchEntry()==self._slot1.getSchedule().getEntries()[0])
        self.assert_(p2.getSchEntry()==self._slot1.getSchedule().getEntries()[1])
        self.assert_(p3.getSchEntry()==self._slot1.getSchedule().getEntries()[2])
        self._session.removeContribution(p2)
        self.assert_(p1.getDuration()==self._session.getContribDuration())
        self.assert_(p3.getDuration()==self._session.getContribDuration())
        self.assert_(p1.getStartDate()==self._slot1.getStartDate())
        self.assert_(p3.getStartDate()==self._slot1.getStartDate())
        self.assert_(p1.getSchEntry()==self._slot1.getSchedule().getEntries()[0])
        self.assert_(p3.getSchEntry()==self._slot1.getSchedule().getEntries()[1])

    def testStartDateNotChanging(self):
        #tests that changing the start date of an entry scheduled within a
        #   poster schedule has no effect
        p1=Contribution()
        self._session.addContribution(p1)
        self._slot1.getSchedule().addEntry(p1.getSchEntry())
        self.assert_(p1.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
        p1.setStartDate(datetime(2004,1,1,11,25,tzinfo=timezone('UTC')))
        self.assert_(p1.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))

    def testChangeSlotStartDate(self):
        #checks that changing the start date of a slot changes all the entries'
        p1,p2=Contribution(),Contribution()
        self._session.addContribution(p1)
        self._session.addContribution(p2)
        self._slot1.getSchedule().addEntry(p1.getSchEntry())
        self._slot1.getSchedule().addEntry(p2.getSchEntry())
        self.assert_(p1.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
        self.assert_(p2.getStartDate()==datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
        self._slot1.setStartDate(datetime(2004,1,1,11,25,tzinfo=timezone('UTC')))