Exemplo n.º 1
0
 def testBasicAddAndRemove( self ):
     session1,session2=Session(),Session()
     self._conf.addSession(session1)
     self.assert_(self._conf.getSessionById(session1.getId())==session1)
     self.assert_(session1 in self._conf.getSessionList())
     session1.delete()
     self.assert_(session1 not in self._conf.getSessionList())
     self.assert_(self._conf.getSessionById(session1.getId())==None)
Exemplo n.º 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())
Exemplo n.º 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())