示例#1
0
 def testSessionInclusion(self):
     session1,session2=Session(),Session()
     self._conf.addSession(session1)
     self._conf.addSession(session2)
     contrib1=Contribution()
     self._conf.addContribution(contrib1)
     contrib1.setTitle("debug")
     contrib1.setSession(session1)
     self.assert_(self._conf.hasContribution(contrib1))
     self.assert_(session1.hasContribution(contrib1))
     self.assert_(not session2.hasContribution(contrib1))
     contrib1.setSession(session2)
     self.assert_(self._conf.hasContribution(contrib1))
     self.assert_(not session1.hasContribution(contrib1))
     self.assert_(session2.hasContribution(contrib1))
     contrib1.setSession(None)
     self.assert_(self._conf.hasContribution(contrib1))
     self.assert_(not session1.hasContribution(contrib1))
     self.assert_(not session2.hasContribution(contrib1))
     contrib1.setSession(session1)
     self.assert_(self._conf.hasContribution(contrib1))
     self.assert_(session1.hasContribution(contrib1))
     self.assert_(not session2.hasContribution(contrib1))
     self._conf.removeContribution(contrib1)
     self.assert_(not self._conf.hasContribution(contrib1))
     self.assert_(not session1.hasContribution(contrib1))
     self.assert_(contrib1 not in session1.getContributionList())
     self.assert_(not session2.hasContribution(contrib1))
     self.assert_(contrib1 not in session2.getContributionList())
示例#2
0
 def testAddRemoveSessions(self):
     s1,s2=Session(),Session()
     self._conf.addSession(s1)
     self._conf.addSession(s2)
     self.assert_(s1 in self._conf.getSessionList())
     self.assert_(s1==self._conf.getSessionById(s1.getId()))
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(s2==self._conf.getSessionById(s2.getId()))
     self._conf.removeSession(s1)
     self.assert_(s1 not in self._conf.getSessionList())
     self.assert_(None==self._conf.getSessionById(s1.getId()))
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(s2==self._conf.getSessionById(s2.getId()))
     c1,c2,c3=Contribution(),Contribution(),Contribution()
     self._conf.addSession(s1)
     s1.addContribution(c1)
     s1.addContribution(c2)
     s2.addContribution(c3)
     self.assert_(s1 in self._conf.getSessionList())
     self.assert_(s1==self._conf.getSessionById(s1.getId()))
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(s2==self._conf.getSessionById(s2.getId()))
     self.assert_(c1 in self._conf.getContributionList())
     self.assert_(c2 in self._conf.getContributionList())
     self.assert_(c3 in self._conf.getContributionList())
     self.assert_(c1 in s1.getContributionList())
     self.assert_(c2 in s1.getContributionList())
     self.assert_(c3 in s2.getContributionList())
     self._conf.removeSession(s1)
     self.assert_(s1 not in self._conf.getSessionList())
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(c1 in self._conf.getContributionList())
     self.assert_(c2 in self._conf.getContributionList())
     self.assert_(c3 in self._conf.getContributionList())
     self.assert_(c1 not in s1.getContributionList())
     self.assert_(c1.getSession()==None)
     self.assert_(c2.getSession()==None)
     self.assert_(c2 not in s1.getContributionList())
     self.assert_(c3 in s2.getContributionList())
示例#3
0
 def testAddRemoveSessions(self):
     s1, s2 = Session(), Session()
     self._conf.addSession(s1)
     self._conf.addSession(s2)
     self.assert_(s1 in self._conf.getSessionList())
     self.assert_(s1 == self._conf.getSessionById(s1.getId()))
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(s2 == self._conf.getSessionById(s2.getId()))
     self._conf.removeSession(s1)
     self.assert_(s1 not in self._conf.getSessionList())
     self.assert_(None == self._conf.getSessionById(s1.getId()))
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(s2 == self._conf.getSessionById(s2.getId()))
     c1, c2, c3 = Contribution(), Contribution(), Contribution()
     self._conf.addSession(s1)
     s1.addContribution(c1)
     s1.addContribution(c2)
     s2.addContribution(c3)
     self.assert_(s1 in self._conf.getSessionList())
     self.assert_(s1 == self._conf.getSessionById(s1.getId()))
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(s2 == self._conf.getSessionById(s2.getId()))
     self.assert_(c1 in self._conf.getContributionList())
     self.assert_(c2 in self._conf.getContributionList())
     self.assert_(c3 in self._conf.getContributionList())
     self.assert_(c1 in s1.getContributionList())
     self.assert_(c2 in s1.getContributionList())
     self.assert_(c3 in s2.getContributionList())
     self._conf.removeSession(s1)
     self.assert_(s1 not in self._conf.getSessionList())
     self.assert_(s2 in self._conf.getSessionList())
     self.assert_(c1 in self._conf.getContributionList())
     self.assert_(c2 in self._conf.getContributionList())
     self.assert_(c3 in self._conf.getContributionList())
     self.assert_(c1 not in s1.getContributionList())
     self.assert_(c1.getSession() == None)
     self.assert_(c2.getSession() == None)
     self.assert_(c2 not in s1.getContributionList())
     self.assert_(c3 in s2.getContributionList())