当前位置: 首页>>代码示例>>Python>>正文


Python MailNotificationHandler.get_build_options方法代码示例

本文整理汇总了Python中changes.listeners.mail.MailNotificationHandler.get_build_options方法的典型用法代码示例。如果您正苦于以下问题:Python MailNotificationHandler.get_build_options方法的具体用法?Python MailNotificationHandler.get_build_options怎么用?Python MailNotificationHandler.get_build_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在changes.listeners.mail.MailNotificationHandler的用法示例。


在下文中一共展示了MailNotificationHandler.get_build_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_multiple_jobs

# 需要导入模块: from changes.listeners.mail import MailNotificationHandler [as 别名]
# 或者: from changes.listeners.mail.MailNotificationHandler import get_build_options [as 别名]
    def test_multiple_jobs(self):
        project = self.create_project()
        build = self.create_build(project, result=Result.failed)
        job1 = self.create_job(build, result=Result.failed)
        job2 = self.create_job(build, result=Result.failed)
        plan1 = self.create_plan(project)
        plan2 = self.create_plan(project)

        # Plan1 options.
        db.session.add(ItemOption(
            item_id=plan1.id,
            name='mail.notify-addresses',
            value='[email protected]',
        ))
        db.session.add(ItemOption(
            item_id=plan1.id,
            name='mail.notify-author',
            value='0',
        ))

        # Plan2 options.
        db.session.add(ItemOption(
            item_id=plan2.id,
            name='mail.notify-addresses',
            value='[email protected]',
        ))
        db.session.add(ItemOption(
            item_id=plan2.id,
            name='mail.notify-author',
            value='1',
        ))

        # Project options (notify-author is set to test that plan options can
        # override it).
        db.session.add(ProjectOption(
            project_id=project.id,
            name='mail.notify-author',
            value='0',
        ))

        # Set notify addresses to verify that it is not used when all jobs
        # override it.
        db.session.add(ProjectOption(
            project_id=project.id,
            name='mail.notify-addresses',
            value='[email protected]',
        ))
        db.session.flush()

        for job, plan in [(job1, plan1), (job2, plan2)]:
            self.create_job_plan(job, plan)

        db.session.commit()

        handler = MailNotificationHandler()
        assert handler.get_build_options(build) == {
            'mail.notify-addresses': {'[email protected]', '[email protected]'},
            'mail.notify-addresses-revisions': set(),
            'mail.notify-author': True,
        }
开发者ID:,项目名称:,代码行数:62,代码来源:

示例2: test_simple

# 需要导入模块: from changes.listeners.mail import MailNotificationHandler [as 别名]
# 或者: from changes.listeners.mail.MailNotificationHandler import get_build_options [as 别名]
    def test_simple(self):
        project = self.create_project()
        plan = self.create_plan(project)
        build = self.create_build(project, result=Result.failed)
        job = self.create_job(build, result=Result.failed)

        db.session.add(ItemOption(
            item_id=plan.id,
            name='mail.notify-author',
            value='0',
        ))

        db.session.add(ProjectOption(
            project_id=project.id,
            name='mail.notify-author',
            value='1',
        ))

        db.session.add(ProjectOption(
            project_id=project.id,
            name='mail.notify-addresses',
            value='[email protected]',
        ))
        db.session.flush()

        self.create_job_plan(job, plan)

        db.session.commit()

        handler = MailNotificationHandler()
        assert handler.get_build_options(build) == {
            'mail.notify-addresses': {'[email protected]'},
            'mail.notify-addresses-revisions': set(),
            'mail.notify-author': False,
        }
开发者ID:,项目名称:,代码行数:37,代码来源:


注:本文中的changes.listeners.mail.MailNotificationHandler.get_build_options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。