Exemplo n.º 1
0
class TestContributionSubmitterIndex(unittest.TestCase):
    """
    """

    def setUp( self ):
        self._creator = Avatar()
        self._creator.setId("creator")
        self._categ = Category()
        self._conf=Conference(self._creator)
        self._conf.setId('a')
        self._conf.setTimezone('UTC')
        self._categ._addConference(self._conf)

    def testBasic(self):
        c1,c2=Contribution(),Contribution()
        av1,av2=Avatar(),Avatar()
        av1.setId("1")
        av2.setId("2")
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==0)
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
        self._conf.addContribution(c1)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==0)
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
        c1.grantSubmission(av1)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
        c2.grantSubmission(av2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
        self._conf.addContribution(c2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==1)
        self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
        c1.grantSubmission(av2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==2)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av2))
        self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
        c1.revokeSubmission(av2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==1)
        self.assert_(c1 not in self._conf.getContribsForSubmitter(av2))
        self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
        self._conf.removeContribution(c2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
        self.assert_(c1 not in self._conf.getContribsForSubmitter(av2))
        self.assert_(c2 not in self._conf.getContribsForSubmitter(av2))
Exemplo n.º 2
0
class TestContributionSubmitterIndex(unittest.TestCase):
    """
    """
    def setUp(self):
        self._creator = Avatar()
        self._creator.setId("creator")
        self._categ = Category()
        self._conf = Conference(self._creator)
        self._conf.setId('a')
        self._conf.setTimezone('UTC')
        self._categ._addConference(self._conf)

    def testBasic(self):
        c1, c2 = Contribution(), Contribution()
        av1, av2 = Avatar(), Avatar()
        av1.setId("1")
        av2.setId("2")
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 0)
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 0)
        self._conf.addContribution(c1)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 0)
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 0)
        c1.grantSubmission(av1)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 0)
        c2.grantSubmission(av2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 0)
        self._conf.addContribution(c2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 1)
        self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
        c1.grantSubmission(av2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 2)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av2))
        self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
        c1.revokeSubmission(av2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 1)
        self.assert_(c1 not in self._conf.getContribsForSubmitter(av2))
        self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
        self._conf.removeContribution(c2)
        self.assert_(len(self._conf.getContribsForSubmitter(av1)) == 1)
        self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
        self.assert_(len(self._conf.getContribsForSubmitter(av2)) == 0)
        self.assert_(c1 not in self._conf.getContribsForSubmitter(av2))
        self.assert_(c2 not in self._conf.getContribsForSubmitter(av2))
Exemplo n.º 3
0
class TestAuthorIndex(unittest.TestCase):
    """Tests the author index
    """

    def setUp( self ):
        self._creator = Avatar()
        self._creator.setId("creator")
        self._categ = Category()
        self._conf=Conference(self._creator)
        self._conf.setId('a')
        self._conf.setTimezone('UTC')
        self._categ._addConference(self._conf)

    def testBasicIndexing(self):
        #Tests adding a contribution with some authors already on it
        c1=Contribution()
        self._conf.addContribution(c1)
        auth1,auth2=ContributionParticipation(),ContributionParticipation()
        auth1.setFirstName("hector")
        auth1.setFamilyName("sanchez sanmartin")
        auth1.setEmail("*****@*****.**")
        auth2.setFirstName("jose benito")
        auth2.setFamilyName("gonzalez lopez")
        auth2.setEmail("*****@*****.**")
        c1.addPrimaryAuthor(auth1)
        c1.addPrimaryAuthor(auth2)
        idx=self._conf.getAuthorIndex()
        self.assert_(auth1 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1])==1)
        self.assert_(auth2 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0])==1)
        c2=Contribution()
        self._conf.addContribution(c2)
        auth3,auth4=ContributionParticipation(),ContributionParticipation()
        auth3.setFirstName("hector")
        auth3.setFamilyName("sanchez sanmartin")
        auth3.setEmail("*****@*****.**")
        auth4.setFirstName("jose benito")
        auth4.setFamilyName("gonzalez lopez2")
        auth4.setEmail("*****@*****.**")
        c2.addPrimaryAuthor(auth3)
        c2.addPrimaryAuthor(auth4)
        #Tests removing a contribution from a conference updates the author 
        #   index correctly
        #self.assert_(auth3 in idx.getParticipations()[2])
        #self.assert_(len(idx.getParticipations()[2])==2)
        #self.assert_(auth4 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self._conf.removeContribution(c2)
        #self.assert_(auth1 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)
        #Tests adding additional authors to a contribution which is already
        #   included in a conference updates the author index correctly
        #auth5=ContributionParticipation()
        #auth5.setFirstName("jean-yves")
        #auth5.setFamilyName("le meur")
        #auth5.setEmail("*****@*****.**")
        #c1.addPrimaryAuthor(auth5)
        #self.assert_(auth1 in idx.getParticipations()[2])
        #self.assert_(len(idx.getParticipations()[2])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)
        #self.assert_(auth5 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #Tests removing authors from a contribution which is already
        #   included in a conference updates the author index correctly
        #c1.removePrimaryAuthor(auth5)
        #self.assert_(auth1 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)

    def testChangesInAuthorData(self):
        #Checks that changes in the author data updates the author index 
        #   correctly
        c1=Contribution()
        self._conf.addContribution(c1)
        auth1,auth2=ContributionParticipation(),ContributionParticipation()
        auth1.setFirstName("zFN")
        auth1.setFamilyName("zSN")
        auth1.setEmail("zM")
        auth2.setFirstName("AFN")
        auth2.setFamilyName("ASN")
        auth2.setEmail("aM")
        c1.addPrimaryAuthor(auth1)
        c1.addPrimaryAuthor(auth2)
        
        idx=self._conf.getAuthorIndex()
        self.assert_(auth1 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1])==1)
        self.assert_(auth2 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0])==1)
        auth2.setFamilyName("ZZSN")
        self.assert_(auth1 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0])==1)
        self.assert_(auth2 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1])==1)
Exemplo n.º 4
0
class TestAuthorIndex(unittest.TestCase):
    """Tests the author index
    """
    def setUp(self):
        self._creator = Avatar()
        self._creator.setId("creator")
        self._categ = Category()
        self._conf = Conference(self._creator)
        self._conf.setId('a')
        self._conf.setTimezone('UTC')
        self._categ._addConference(self._conf)

    def testBasicIndexing(self):
        #Tests adding a contribution with some authors already on it
        c1 = Contribution()
        self._conf.addContribution(c1)
        auth1, auth2 = ContributionParticipation(), ContributionParticipation()
        auth1.setFirstName("hector")
        auth1.setFamilyName("sanchez sanmartin")
        auth1.setEmail("*****@*****.**")
        auth2.setFirstName("jose benito")
        auth2.setFamilyName("gonzalez lopez")
        auth2.setEmail("*****@*****.**")
        c1.addPrimaryAuthor(auth1)
        c1.addPrimaryAuthor(auth2)
        idx = self._conf.getAuthorIndex()
        self.assert_(auth1 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1]) == 1)
        self.assert_(auth2 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0]) == 1)
        c2 = Contribution()
        self._conf.addContribution(c2)
        auth3, auth4 = ContributionParticipation(), ContributionParticipation()
        auth3.setFirstName("hector")
        auth3.setFamilyName("sanchez sanmartin")
        auth3.setEmail("*****@*****.**")
        auth4.setFirstName("jose benito")
        auth4.setFamilyName("gonzalez lopez2")
        auth4.setEmail("*****@*****.**")
        c2.addPrimaryAuthor(auth3)
        c2.addPrimaryAuthor(auth4)
        #Tests removing a contribution from a conference updates the author
        #   index correctly
        #self.assert_(auth3 in idx.getParticipations()[2])
        #self.assert_(len(idx.getParticipations()[2])==2)
        #self.assert_(auth4 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self._conf.removeContribution(c2)
        #self.assert_(auth1 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)
        #Tests adding additional authors to a contribution which is already
        #   included in a conference updates the author index correctly
        #auth5=ContributionParticipation()
        #auth5.setFirstName("jean-yves")
        #auth5.setFamilyName("le meur")
        #auth5.setEmail("*****@*****.**")
        #c1.addPrimaryAuthor(auth5)
        #self.assert_(auth1 in idx.getParticipations()[2])
        #self.assert_(len(idx.getParticipations()[2])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)
        #self.assert_(auth5 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #Tests removing authors from a contribution which is already
        #   included in a conference updates the author index correctly
        #c1.removePrimaryAuthor(auth5)
        #self.assert_(auth1 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)

    def testChangesInAuthorData(self):
        #Checks that changes in the author data updates the author index
        #   correctly
        c1 = Contribution()
        self._conf.addContribution(c1)
        auth1, auth2 = ContributionParticipation(), ContributionParticipation()
        auth1.setFirstName("zFN")
        auth1.setFamilyName("zSN")
        auth1.setEmail("zM")
        auth2.setFirstName("AFN")
        auth2.setFamilyName("ASN")
        auth2.setEmail("aM")
        c1.addPrimaryAuthor(auth1)
        c1.addPrimaryAuthor(auth2)

        idx = self._conf.getAuthorIndex()
        self.assert_(auth1 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1]) == 1)
        self.assert_(auth2 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0]) == 1)
        auth2.setFamilyName("ZZSN")
        self.assert_(auth1 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0]) == 1)
        self.assert_(auth2 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1]) == 1)