當前位置: 首頁>>代碼示例>>Python>>正文


Python Conference.newTrack方法代碼示例

本文整理匯總了Python中MaKaC.conference.Conference.newTrack方法的典型用法代碼示例。如果您正苦於以下問題:Python Conference.newTrack方法的具體用法?Python Conference.newTrack怎麽用?Python Conference.newTrack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MaKaC.conference.Conference的用法示例。


在下文中一共展示了Conference.newTrack方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestNotification

# 需要導入模塊: from MaKaC.conference import Conference [as 別名]
# 或者: from MaKaC.conference.Conference import newTrack [as 別名]
class TestNotification(unittest.TestCase):
    """
    """

    def setUp(self):
        from MaKaC.user import Avatar

        av = Avatar()
        from MaKaC.conference import Conference

        self._conf = Conference(av)
        self._track1 = self._conf.newTrack()
        self._track2 = self._conf.newTrack()
        self._track3 = self._conf.newTrack()
        absMgr = self._conf.getAbstractMgr()
        self._contribTypeOral = "oral"
        self._contribTypePoster = "poster"
        # absMgr.addContribType(self._contribTypeOral)
        # absMgr.addContribType(self._contribTypePoster)
        # from MaKaC.user import Avatar
        # self._submitter = Avatar()
        # self._submitter.setId( "submitter" )
        # self._abstract=self._conf.getAbstractMgr().newAbstract(self._submitter)
        # self._abstract.addTrack(self._track1)

    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)
        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 testTplCondAccTrack(self):
        # test different possibilities when a condition has been stablished for
        #   a certain track
        from MaKaC.review import NotificationTemplate

        tpl1 = NotificationTemplate()
        absMgr = self._conf.getAbstractMgr()
        absMgr.addNotificationTpl(tpl1)
        from MaKaC.review import NotifTplCondAccepted

        cond1 = NotifTplCondAccepted(track=self._track1, 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) is None)

    def testTplCondAccAnyTrack(self):
        # test different possibilities when a condition has been stablished for
#.........這裏部分代碼省略.........
開發者ID:lukasnellen,項目名稱:indico,代碼行數:103,代碼來源:testCFA.py


注:本文中的MaKaC.conference.Conference.newTrack方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。