コード例 #1
0
ファイル: testConferences.py プロジェクト: lukasnellen/indico
 def testSessions(self):
     s1=Session()
     self._conf.addSession(s1)
     sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
     ed=datetime(2004, 01, 01, 16, 00, tzinfo=timezone('UTC'))
     s1.setDates(sd,ed)
     slot1=SessionSlot(s1)
     s1.addSlot(slot1)
     slot1.setStartDate(datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
コード例 #2
0
ファイル: testConferences.py プロジェクト: lukasnellen/indico
 def testSessions(self):
     s1 = Session()
     self._conf.addSession(s1)
     sd = datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
     ed = datetime(2004, 01, 01, 16, 00, tzinfo=timezone('UTC'))
     s1.setDates(sd, ed)
     slot1 = SessionSlot(s1)
     s1.addSlot(slot1)
     slot1.setStartDate(
         datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
コード例 #3
0
 def testBasicWithdrawal(self):
     c1,c2=Contribution(),Contribution()
     auth1,auth2=ContributionParticipation(),ContributionParticipation()
     self._conf.addContribution(c1)
     self._conf.addContribution(c2)
     auth1.setFirstName("a")
     auth1.setFamilyName("a")
     auth1.setEmail("a")
     auth2.setFirstName("b")
     auth2.setFamilyName("b")
     auth2.setEmail("b")
     c1.addPrimaryAuthor(auth1)
     c2.addPrimaryAuthor(auth2)
     s1=Session()
     sd=datetime(2004, 01, 01, 12, 00, tzinfo=timezone("UTC"))
     ed=datetime(2004, 01, 01, 19, 00, tzinfo=timezone("UTC"))
     s1.setDates(sd,ed)
     slot1=SessionSlot(s1)
     self._conf.addSession(s1)
     s1.addSlot(slot1)
     s1.addContribution(c1)
     s1.addContribution(c2)
     slot1.getSchedule().addEntry(c1.getSchEntry())
     slot1.getSchedule().addEntry(c2.getSchEntry())
     self.assert_(c1.isScheduled())
     self.assert_(c2.isScheduled())
     authIdx=self._conf.getAuthorIndex()
     self.assert_(auth1 in authIdx.getParticipations()[0])
     self.assert_(auth2 in authIdx.getParticipations()[1])
     c1.withdraw(self._creator,"test")
     self.assert_(not c1.isScheduled())
     self.assert_(c2.isScheduled())
     self.assert_(auth1 not in authIdx.getParticipations()[0])
     self.assert_(auth2 in authIdx.getParticipations()[0])
     auth1.setFirstName("aa")
     self.assert_(auth1 not in authIdx.getParticipations()[0])
     self.assert_(auth2 in authIdx.getParticipations()[0])
     auth3,auth4=ContributionParticipation(),ContributionParticipation()
     auth3.setFirstName("c")
     auth3.setFamilyName("c")
     auth3.setEmail("c")
     auth4.setFirstName("d")
     auth4.setFamilyName("d")
     auth4.setEmail("d")
     c1.addPrimaryAuthor(auth3)
     c2.addPrimaryAuthor(auth4)
     self.assert_(auth2 in authIdx.getParticipations()[0])
     self.assert_(auth4 in authIdx.getParticipations()[1])
     self.assertRaises(MaKaCError,slot1.getSchedule().addEntry,c1.getSchEntry())
コード例 #4
0
ファイル: testSessions.py プロジェクト: lukasnellen/indico
 def testDates(self):
     session1=Session()
     #self._conf.setStartDate(datetime(2004,1,1,8,0,tzinfo=timezone('UTC')))
     #self._conf.setEndDate(datetime(2005,1,1,8,0,tzinfo=timezone('UTC')))
     session1.setStartDate(datetime(2004,2,15,tzinfo=timezone('UTC')))
     self.assertRaises(MaKaCError,session1.setEndDate,datetime(2004,2,14,tzinfo=timezone('UTC')))
     session1.setEndDate(datetime(2004,2,16,tzinfo=timezone('UTC')))
     self.assert_(session1.getStartDate()==datetime(2004,2,15,tzinfo=timezone('UTC')))
     self.assert_(session1.getEndDate()==datetime(2004,2,16,tzinfo=timezone('UTC')))
     session1.setDates(datetime(2004,2,10,tzinfo=timezone('UTC')),datetime(2004,2,11,tzinfo=timezone('UTC')))
     self.assert_(session1.getStartDate()==datetime(2004,2,10,tzinfo=timezone('UTC')))
     self.assert_(session1.getEndDate()==datetime(2004,2,11,tzinfo=timezone('UTC')))
     session1.setDates(datetime(2004,2,15,tzinfo=timezone('UTC')),datetime(2004,2,16,tzinfo=timezone('UTC')))
     self.assert_(session1.getStartDate()==datetime(2004,2,15,tzinfo=timezone('UTC')))
     self.assert_(session1.getEndDate()==datetime(2004,2,16,tzinfo=timezone('UTC')))
     session1.setDates(datetime(2004,2,14,tzinfo=timezone('UTC')),datetime(2004,2,17,tzinfo=timezone('UTC')))
     self.assert_(session1.getStartDate()==datetime(2004,2,14,tzinfo=timezone('UTC')))
     self.assert_(session1.getEndDate()==datetime(2004,2,17,tzinfo=timezone('UTC')))
コード例 #5
0
    def setUp(self):
        '''
        Create a conference, 0
        Add 2 contributions to this conference, 0 and 1
        To contribution 0 - Add 2 speakers, person1 and person2
        To contribution 1 - Add 1 speaker, person1
        '''
        super(TestElectronicAgreement, self).setUp()
        with self._context('database', 'request'):

            # Create few users
            self._creator = Avatar({"name":"God", "email":"*****@*****.**"})
            self._creator.setId("creator")
                # Set God as admin
            AdminList.getInstance().getList().append(self._creator)

            self.person1 = Avatar({"name":"giuseppe", "email":"*****@*****.**"})
            self.person1.setId("spk1")
            self.person2 = Avatar({"name":"gabriele", "email":"*****@*****.**"})
            self.person1.setId("spk2")
            self.person3 = Avatar({"name":"lorenzo", "email":"*****@*****.**"})
            self.person1.setId("spk3")
            self.person4 = Avatar({"name":"silvio", "email":"*****@*****.**"})
            self.person1.setId("spk4")

            ah = AvatarHolder()
            ah.add(self.person1)
            ah.add(self.person2)
            ah.add(self.person3)
            ah.add(self.person4)

            # Create a conference
            category = conference.CategoryManager().getById('0')
            self._conf = category.newConference(self._creator)
            self._conf.setTimezone('UTC')
            sd=datetime(2011, 06, 01, 10, 00, tzinfo=timezone("UTC"))
            ed=datetime(2011, 06, 05, 10, 00, tzinfo=timezone("UTC"))
            self._conf.setDates(sd,ed,)
            ch = ConferenceHolder()
            ch.add(self._conf)

            # Create contributions and add to the conference
            c1, c2 = Contribution(), Contribution()
            self.speaker1, self.speaker2 = ContributionParticipation(), ContributionParticipation()

            self.speaker1.setDataFromAvatar(self.person1)
            self.speaker2.setDataFromAvatar(self.person2)

            self._conf.addContribution(c2)
            self._conf.addContribution(c1)

            # Add speakers to contributions
            c1.addPrimaryAuthor(self.speaker1)
            c2.addPrimaryAuthor(self.speaker2)
            c1.addSpeaker(self.speaker1)
            c2.addSpeaker(self.speaker1)
            c2.addSpeaker(self.speaker2)

            self._conf.enableSessionSlots()

            # Create session and schedule the contributions
            s1 = Session()
            sd = datetime(2011, 06, 02, 12, 00, tzinfo=timezone("UTC"))
            ed = datetime(2011, 06, 02, 19, 00, tzinfo=timezone("UTC"))
            s1.setDates(sd, ed)

            slot1 = SessionSlot(s1)
            self._conf.addSession(s1)
            slot1.setValues({"sDate":sd})
            s1.addSlot(slot1)

            s1.addContribution(c1)
            s1.addContribution(c2)
            slot1.getSchedule().addEntry(c1.getSchEntry())
            slot1.getSchedule().addEntry(c2.getSchEntry())
            self.createAndAcceptBooking()
コード例 #6
0
    def setUp(self):
        '''
        Create a conference, 0
        Add 2 contributions to this conference, 0 and 1
        To contribution 0 - Add 2 speakers, person1 and person2
        To contribution 1 - Add 1 speaker, person1
        '''
        super(TestElectronicAgreement, self).setUp()

        self._startDBReq()

        self.falseSession = FalseSession()
        # Create few users
        self._creator = Avatar({"name": "God", "email": "*****@*****.**"})
        self._creator.setId("creator")
        # Set God as admin
        AdminList.getInstance().getList().append(self._creator)

        self.person1 = Avatar({"name": "giuseppe", "email": "*****@*****.**"})
        self.person1.setId("spk1")
        self.person2 = Avatar({"name": "gabriele", "email": "*****@*****.**"})
        self.person1.setId("spk2")
        self.person3 = Avatar({"name": "lorenzo", "email": "*****@*****.**"})
        self.person1.setId("spk3")
        self.person4 = Avatar({"name": "silvio", "email": "*****@*****.**"})
        self.person1.setId("spk4")

        ah = AvatarHolder()
        ah.add(self.person1)
        ah.add(self.person2)
        ah.add(self.person3)
        ah.add(self.person4)

        # Create a conference
        category = conference.CategoryManager().getById('0')
        self._conf = category.newConference(self._creator)
        self._conf.setTimezone('UTC')
        sd = datetime(2011, 06, 01, 10, 00, tzinfo=timezone("UTC"))
        ed = datetime(2011, 06, 05, 10, 00, tzinfo=timezone("UTC"))
        self._conf.setDates(
            sd,
            ed,
        )
        ch = ConferenceHolder()
        ch.add(self._conf)

        # Create contributions and add to the conference
        c1, c2 = Contribution(), Contribution()
        self.speaker1, self.speaker2 = ContributionParticipation(
        ), ContributionParticipation()

        self.speaker1.setDataFromAvatar(self.person1)
        self.speaker2.setDataFromAvatar(self.person2)

        self._conf.addContribution(c2)
        self._conf.addContribution(c1)

        # Add speakers to contributions
        c1.addPrimaryAuthor(self.speaker1)
        c2.addPrimaryAuthor(self.speaker2)
        c1.addSpeaker(self.speaker1)
        c2.addSpeaker(self.speaker1)
        c2.addSpeaker(self.speaker2)

        self._conf.enableSessionSlots()

        # Create session and schedule the contributions
        s1 = Session()
        sd = datetime(2011, 06, 02, 12, 00, tzinfo=timezone("UTC"))
        ed = datetime(2011, 06, 02, 19, 00, tzinfo=timezone("UTC"))
        s1.setDates(sd, ed)

        slot1 = SessionSlot(s1)
        self._conf.addSession(s1)
        slot1.setValues({"sDate": sd})
        s1.addSlot(slot1)

        s1.addContribution(c1)
        s1.addContribution(c2)
        slot1.getSchedule().addEntry(c1.getSchEntry())
        slot1.getSchedule().addEntry(c2.getSchEntry())

        self.createAndAcceptBooking()
        self._stopDBReq()
コード例 #7
0
ファイル: testConferences.py プロジェクト: lukasnellen/indico
 def testSessions(self):
     s1=Session()
     s1.setDates(datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')),datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC')))
コード例 #8
0
ファイル: testConferences.py プロジェクト: lukasnellen/indico
    """
    def setUp(self):
        a = Avatar()
        a.setId("creator")
        self._conf=Conference(a)
        self._conf.setTimezone('UTC')
        sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
        ed=datetime(2004, 01, 05, 10, 00, tzinfo=timezone('UTC'))
        self._conf.setDates(sd,ed)

    def testSessions(self):
        s1=Session()
        s1.setDates(datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')),datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC')))
        self._conf.addSession(s1)
        s2=Session()
        s2.setDates(datetime(2004, 01, 01, 15, 00, tzinfo=timezone('UTC')),datetime(2004, 01, 01, 18, 00, tzinfo=timezone('UTC')))
        self._conf.addSession(s2)
        #checks that modifying conference dates which does not affect to 
        #   sessions is allowed
        self._conf.setStartDate(datetime(2004, 01, 01, 9, 00, tzinfo=timezone('UTC')))
        self._conf.setEndDate(datetime(2004, 01, 01, 19, 00, tzinfo=timezone('UTC')))
        #if a session is affected an error should be reported
        #self.assertRaises(MaKaCError,self._conf.setStartDate,datetime(2004, 01, 01, 10, 01, tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,self._conf.setEndDate,datetime(2004, 01, 01, 17, 00, tzinfo=timezone('UTC')))

    def testEntries(self):
        c1,c2=Contribution(),Contribution()
        b=BreakTimeSchEntry()
        self._conf.addContribution(c1)
        self._conf.addContribution(c2)
        self._conf.getSchedule().addEntry(c1.getSchEntry())