Exemple #1
0
    def setUp(self):
        super(TestProtection, self).setUp()

        self._startDBReq()

        # Create a user
        ah = AvatarHolder()
        self._avatar = Avatar()
        self._avatar.setName("fake")
        self._avatar.setSurName("fake")
        self._avatar.setOrganisation("fake")
        self._avatar.setLang("en_GB")
        self._avatar.setEmail("*****@*****.**")
        self._avatar.setId("fake")
        ah.add(self._avatar)

        # Create a conference
        category = conference.CategoryManager().getById('0')
        self._conf = category.newConference(self._avatar)
        self._conf.setTimezone('UTC')
        sd = datetime(2011, 11, 1, 10, 0, tzinfo=timezone('UTC'))
        ed = datetime(2011, 11, 1, 18, 0, tzinfo=timezone('UTC'))
        self._conf.setDates(sd, ed)
        ch = ConferenceHolder()
        ch.add(self._conf)

        self._contrib1 = conference.Contribution()
        self._conf.addContribution(self._contrib1)

        self._session1 = conference.Session()
        self._conf.addSession(self._session1)

        self._session2 = conference.Session()
        self._conf.addSession(self._session2)

        self._contrib2 = conference.Contribution()
        self._session1.addContribution(self._contrib2)

        #Now we create the material (id=0) and attach it to the contrib
        self._material = conference.Material()
        self._contrib1.addMaterial(self._material)
        #Now we create a dummy file and attach it to the material
        filePath = os.path.join(os.getcwd(), "test.txt")
        fh = open(filePath, "w")
        fh.write("hola")
        fh.close()
        self._resource = conference.LocalFile()
        self._resource.setFilePath(filePath)
        self._resource.setFileName("test.txt")
        self._material.addResource(self._resource)

        self._stopDBReq()
Exemple #2
0
 def testIdCollission(self):
     #checks that no collission with contributions can happen regarding
     #   the ids
     contrib = conference.Contribution()
     self._conf.addContribution(contrib)
     res1 = self._avatar
     abstract = self._conf.getAbstractMgr().newAbstract(res1)
     #accepting an abstract for a certain track
     self._abstract.accept(res1, self._track1, self._ctOral)
     self.assertNotEqual(contrib.getId(), abstract.getId())
Exemple #3
0
    def setUp(self):
        super(TestProtection, self).setUp()

        with self._context("database"):
            # Create a conference
            category = conference.CategoryManager().getById('0')
            self._conf = category.newConference(self._dummy)
            self._conf.setTimezone('UTC')
            sd = datetime(2011, 11, 1, 10, 0, tzinfo=timezone('UTC'))
            ed = datetime(2011, 11, 1, 18, 0, tzinfo=timezone('UTC'))
            self._conf.setDates(sd, ed)
            ch = ConferenceHolder()
            ch.add(self._conf)

            self._contrib1 = conference.Contribution()
            self._conf.addContribution(self._contrib1)

            self._session1 = conference.Session()
            self._conf.addSession(self._session1)

            self._session2 = conference.Session()
            self._conf.addSession(self._session2)

            self._contrib2 = conference.Contribution()
            self._session1.addContribution(self._contrib2)

            #Now we create the material (id=0) and attach it to the contrib
            self._material = conference.Material()
            self._contrib1.addMaterial( self._material )
            #Now we create a dummy file and attach it to the material
            filePath = os.path.join( os.getcwd(), "test.txt" )
            fh = open(filePath, "w")
            fh.write("hola")
            fh.close()
            self._resource = conference.LocalFile()
            self._resource.setFilePath( filePath )
            self._resource.setFileName( "test.txt" )
            self._material.addResource( self._resource )