def testTplCondAccAnyTrack(self): #test different possibilities when a condition has been stablished for # a notif tpl on any track from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) from MaKaC.review import NotifTplCondAccepted cond1 = NotifTplCondAccepted(contribType=self._contribTypeOral) tpl1.addCondition(cond1) from MaKaC.user import Avatar submitter = Avatar() submitter.setId("submitter") abs1 = absMgr.newAbstract(submitter) abs1.accept(submitter, self._track1, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs1) == tpl1) abs2 = absMgr.newAbstract(submitter) abs2.accept(submitter, self._track1, self._contribTypePoster) self.assert_(absMgr.getNotifTplForAbstract(abs2) is None) abs3 = absMgr.newAbstract(submitter) abs3.accept(submitter, self._track2, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs3) == tpl1) abs4 = absMgr.newAbstract(submitter) abs4.accept(submitter, None, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs4) == tpl1)
def testTplCondAccNoneTrack(self): # test different possibilities when a condition has been stablished for # a notif tpl on none track from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) from MaKaC.review import NotifTplCondAccepted cond1 = NotifTplCondAccepted(track=None, contribType=self._contribTypeOral) tpl1.addCondition(cond1) from MaKaC.user import Avatar submitter = Avatar() submitter.setId("submitter") abs1 = absMgr.newAbstract(submitter) abs1.accept(submitter, self._track1, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs1) is None) abs2 = absMgr.newAbstract(submitter) abs2.accept(submitter, self._track1, self._contribTypePoster) self.assert_(absMgr.getNotifTplForAbstract(abs2) is None) abs3 = absMgr.newAbstract(submitter) abs3.accept(submitter, None, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs3) == tpl1)
def testTplConditions(self): #test adding and removing conditions to templates from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() tpl2 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) absMgr.addNotificationTpl(tpl2) from MaKaC.review import NotifTplCondAccepted, NotifTplCondRejected cond1 = NotifTplCondAccepted(contribType=self._contribTypeOral) cond2 = NotifTplCondRejected() tpl1.addCondition(cond1) tpl2.addCondition(cond2) from MaKaC.user import Avatar submitter = Avatar() submitter.setId("submitter") abs1 = absMgr.newAbstract(submitter) tplRes = absMgr.getNotifTplForAbstract(abs1) self.assert_(tplRes is None) abs1.accept(submitter, self._track1, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs1) == tpl1) abs2 = absMgr.newAbstract(submitter) abs2.accept(submitter, self._track1, self._contribTypePoster) self.assert_(not absMgr.getNotifTplForAbstract(abs2)) abs3 = absMgr.newAbstract(submitter) abs3.reject(submitter) self.assert_(absMgr.getNotifTplForAbstract(abs3) == tpl2)
def testBasicManagement( self ): #test adding and removing notification templates from MaKaC.review import NotificationTemplate tpl1=NotificationTemplate() absMgr=self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) self.assert_(tpl1 in absMgr.getNotificationTplList()) tpl2=NotificationTemplate() absMgr.addNotificationTpl(tpl2) absMgr.removeNotificationTpl(tpl1) self.assert_(tpl2 in absMgr.getNotificationTplList()) self.assert_(tpl1 not in absMgr.getNotificationTplList()) self.assert_(tpl1!=absMgr.getNotificationTplById(tpl1.getId())) self.assert_(tpl2==absMgr.getNotificationTplById(tpl2.getId()))
def testBasicManagement(self): #test adding and removing notification templates tpl1 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) self.assertTrue(tpl1 in absMgr.getNotificationTplList()) tpl2 = NotificationTemplate() absMgr.addNotificationTpl(tpl2) absMgr.removeNotificationTpl(tpl1) self.assertTrue(tpl2 in absMgr.getNotificationTplList()) self.assertFalse(tpl1 in absMgr.getNotificationTplList()) self.assertTrue(tpl2 in absMgr.getNotificationTplList()) self.assertFalse(tpl1 in absMgr.getNotificationTplList()) self.assertNotEqual(tpl1, absMgr.getNotificationTplById(tpl1.getId())) self.assertEqual(tpl2, absMgr.getNotificationTplById(tpl2.getId()))
def testTplCondAccNoneTrack(self): #test different possibilities when a condition has been stablished for # a notif tpl on none track tpl1 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) cond1 = NotifTplCondAccepted(track=None, contribType=self._contribTypeOral) tpl1.addCondition(cond1) abs1 = absMgr.newAbstract(self._dummy) abs1.accept(self._dummy, self._track1, self._contribTypeOral) self.assertTrue(absMgr.getNotifTplForAbstract(abs1) is None) abs2 = absMgr.newAbstract(self._dummy) abs2.accept(self._dummy, self._track1, self._contribTypePoster) self.assertTrue(absMgr.getNotifTplForAbstract(abs2) is None) abs3 = absMgr.newAbstract(self._dummy) abs3.accept(self._dummy, None, self._contribTypeOral) self.assertEqual(absMgr.getNotifTplForAbstract(abs3), tpl1)
def testTplCondAccNoneTrack(self): #test different possibilities when a condition has been stablished for # a notif tpl on none track tpl1 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) cond1 = NotifTplCondAccepted(track=None, contribType=self._contribTypeOral) tpl1.addCondition(cond1) abs1 = absMgr.newAbstract(self._avatar) abs1.accept(self._avatar, self._track1, self._contribTypeOral) self.assertTrue(absMgr.getNotifTplForAbstract(abs1) is None) abs2 = absMgr.newAbstract(self._avatar) abs2.accept(self._avatar, self._track1, self._contribTypePoster) self.assertTrue(absMgr.getNotifTplForAbstract(abs2) is None) abs3 = absMgr.newAbstract(self._avatar) abs3.accept(self._avatar, None, self._contribTypeOral) self.assertEqual(absMgr.getNotifTplForAbstract(abs3), tpl1)
def testTplConditions(self): # test adding and removing conditions to templates from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() tpl2 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) absMgr.addNotificationTpl(tpl2) from MaKaC.review import NotifTplCondAccepted, NotifTplCondRejected cond1 = NotifTplCondAccepted(contribType=self._contribTypeOral) cond2 = NotifTplCondRejected() tpl1.addCondition(cond1) tpl2.addCondition(cond2) abs1 = absMgr.newAbstract(self._dummy) tplRes = absMgr.getNotifTplForAbstract(abs1) self.assertTrue(tplRes is None) abs1.accept(self._dummy, self._track1, self._contribTypeOral) self.assertEqual(absMgr.getNotifTplForAbstract(abs1), tpl1) abs2 = absMgr.newAbstract(self._dummy) abs2.accept(self._dummy, self._track1, self._contribTypePoster) self.assertFalse(absMgr.getNotifTplForAbstract(abs2)) abs3 = absMgr.newAbstract(self._dummy) abs3.reject(self._dummy) self.assertEqual(absMgr.getNotifTplForAbstract(abs3), tpl2)
def testTplConditions(self): # test adding and removing conditions to templates from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() tpl2 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) absMgr.addNotificationTpl(tpl2) from MaKaC.review import NotifTplCondAccepted, NotifTplCondRejected cond1 = NotifTplCondAccepted(contribType=self._contribTypeOral) cond2 = NotifTplCondRejected() tpl1.addCondition(cond1) tpl2.addCondition(cond2) from MaKaC.user import Avatar submitter = Avatar() submitter.setId("submitter") abs1 = absMgr.newAbstract(submitter) tplRes = absMgr.getNotifTplForAbstract(abs1) self.assert_(tplRes is None) abs1.accept(submitter, self._track1, self._contribTypeOral) self.assert_(absMgr.getNotifTplForAbstract(abs1) == tpl1) abs2 = absMgr.newAbstract(submitter) abs2.accept(submitter, self._track1, self._contribTypePoster) self.assert_(not absMgr.getNotifTplForAbstract(abs2)) abs3 = absMgr.newAbstract(submitter) abs3.reject(submitter) self.assert_(absMgr.getNotifTplForAbstract(abs3) == tpl2)
def testBasicManagement(self): #test adding and removing notification templates from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) self.assert_(tpl1 in absMgr.getNotificationTplList()) tpl2 = NotificationTemplate() absMgr.addNotificationTpl(tpl2) absMgr.removeNotificationTpl(tpl1) self.assert_(tpl2 in absMgr.getNotificationTplList()) self.assert_(tpl1 not in absMgr.getNotificationTplList()) self.assert_(tpl1 != absMgr.getNotificationTplById(tpl1.getId())) self.assert_(tpl2 == absMgr.getNotificationTplById(tpl2.getId()))
def testTplConditions(self): #test adding and removing conditions to templates from MaKaC.review import NotificationTemplate tpl1 = NotificationTemplate() tpl2 = NotificationTemplate() absMgr = self._conf.getAbstractMgr() absMgr.addNotificationTpl(tpl1) absMgr.addNotificationTpl(tpl2) from MaKaC.review import NotifTplCondAccepted, NotifTplCondRejected cond1 = NotifTplCondAccepted(contribType=self._contribTypeOral) cond2 = NotifTplCondRejected() tpl1.addCondition(cond1) tpl2.addCondition(cond2) abs1 = absMgr.newAbstract(self._dummy) tplRes = absMgr.getNotifTplForAbstract(abs1) self.assertTrue(tplRes is None) abs1.accept(self._dummy, self._track1, self._contribTypeOral) self.assertEqual(absMgr.getNotifTplForAbstract(abs1), tpl1) abs2 = absMgr.newAbstract(self._dummy) abs2.accept(self._dummy, self._track1, self._contribTypePoster) self.assertFalse(absMgr.getNotifTplForAbstract(abs2)) abs3 = absMgr.newAbstract(self._dummy) abs3.reject(self._dummy) self.assertEqual(absMgr.getNotifTplForAbstract(abs3), tpl2)