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


Python ProjectStatus.create_or_update方法代码示例

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


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

示例1: test_status_of_second_build

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_status_of_second_build(self):
        build = self.create_build('1')
        status1 = ProjectStatus.create_or_update(build)

        build2 = self.create_build('2')
        status2 = ProjectStatus.create_or_update(build2)
        self.assertEqual(status1, status2.get_previous())
        self.assertEqual(build2, status2.build)
开发者ID:Linaro,项目名称:squad,代码行数:10,代码来源:test_project_status.py

示例2: test_cache_test_run_counts_on_update

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_cache_test_run_counts_on_update(self):
        build = self.create_build('1', create_test_run=False)
        ProjectStatus.create_or_update(build)

        build.test_runs.create(environment=self.environment, completed=True)
        build.test_runs.create(environment=self.environment, completed=False)
        status = ProjectStatus.create_or_update(build)
        self.assertEqual(2, status.test_runs_total)
        self.assertEqual(1, status.test_runs_completed)
        self.assertEqual(1, status.test_runs_incomplete)
开发者ID:Linaro,项目名称:squad,代码行数:12,代码来源:test_project_status.py

示例3: test_updates_last_updated

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_updates_last_updated(self):
        build = self.create_build('1', datetime=h(10))
        test_run1 = build.test_runs.first()
        test_run1.tests.create(name='foo', suite=self.suite, result=True)
        status = ProjectStatus.create_or_update(build)
        old_date = status.last_updated

        build.test_runs.create(environment=self.environment)
        status = ProjectStatus.create_or_update(build)

        self.assertNotEqual(status.last_updated, old_date)
开发者ID:Linaro,项目名称:squad,代码行数:13,代码来源:test_project_status.py

示例4: test_previous_must_be_from_the_same_project

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_previous_must_be_from_the_same_project(self):
        previous_build = self.create_build('1', datetime=h(10))
        previous = ProjectStatus.create_or_update(previous_build)

        other_project = self.group.projects.create(slug='other_project')
        other_env = other_project.environments.create(slug='other_env')
        other_build = other_project.builds.create(version='1', datetime=h(5))
        other_build.test_runs.create(environment=other_env)
        ProjectStatus.create_or_update(other_build)

        build = self.create_build('2', datetime=h(0))
        status = ProjectStatus.create_or_update(build)
        self.assertEqual(previous, status.get_previous())
开发者ID:Linaro,项目名称:squad,代码行数:15,代码来源:test_project_status.py

示例5: test_cache_fixes

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_cache_fixes(self):
        build1 = self.create_build('1', datetime=h(10))
        test_run1 = build1.test_runs.first()
        test_run1.tests.create(name='foo', suite=self.suite, result=False)
        ProjectStatus.create_or_update(build1)

        build2 = self.create_build('2', datetime=h(9))
        test_run2 = build2.test_runs.first()
        test_run2.tests.create(name='foo', suite=self.suite, result=True)
        status = ProjectStatus.create_or_update(build2)

        self.assertIsNotNone(status.fixes)
        self.assertIsNone(status.regressions)
开发者ID:Linaro,项目名称:squad,代码行数:15,代码来源:test_project_status.py

示例6: test_send_notification_for_all_builds

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_send_notification_for_all_builds(self, diff):
        self.project.subscriptions.create(email='[email protected]')
        diff.return_value = fake_diff()

        status1 = ProjectStatus.create_or_update(self.build2)
        send_status_notification(status1)
        self.assertEqual(1, len(mail.outbox))

        t = timezone.now() - relativedelta(hours=2.5)
        build = self.project.builds.create(version='3', datetime=t)
        status2 = ProjectStatus.create_or_update(build)
        send_status_notification(status2)

        self.assertEqual(2, len(mail.outbox))
开发者ID:Linaro,项目名称:squad,代码行数:16,代码来源:test_notification.py

示例7: test_delegates_diff_to_test_comparison_object

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_delegates_diff_to_test_comparison_object(self, diff):
        the_diff = {}
        diff.return_value = the_diff

        group = Group.objects.create(slug='mygroup')
        project = group.projects.create(slug='myproject')
        build1 = project.builds.create(version='1')
        ProjectStatus.create_or_update(build1)
        build2 = project.builds.create(version='2')
        status = ProjectStatus.create_or_update(build2)

        notification = Notification(status)

        self.assertIs(the_diff, notification.diff)
开发者ID:Linaro,项目名称:squad,代码行数:16,代码来源:test_notification.py

示例8: setUp

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def setUp(self):
        t0 = timezone.now() - relativedelta(hours=3)
        t = timezone.now() - relativedelta(hours=2.75)

        self.group = Group.objects.create(slug='mygroup')
        self.project = self.group.projects.create(slug='myproject')
        self.build1 = self.project.builds.create(version='1', datetime=t0)
        status = ProjectStatus.create_or_update(self.build1)
        status.notified = True
        status.save()
        self.build2 = self.project.builds.create(version='2', datetime=t)
        self.project.subscriptions.create(email='[email protected]')
        self.project.admin_subscriptions.create(email='[email protected]')
        self.project.moderate_notifications = True
        self.project.save()
        self.status = ProjectStatus.create_or_update(self.build2)
开发者ID:Linaro,项目名称:squad,代码行数:18,代码来源:test_notification.py

示例9: test_send_notification_on_regression_only_with_no_regressions

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
 def test_send_notification_on_regression_only_with_no_regressions(self):
     self.project.subscriptions.create(
         email='[email protected]',
         notification_strategy=Subscription.NOTIFY_ON_REGRESSION)
     status = ProjectStatus.create_or_update(self.build2)
     send_status_notification(status)
     self.assertEqual(0, len(mail.outbox))
开发者ID:Linaro,项目名称:squad,代码行数:9,代码来源:test_notification.py

示例10: test_zero_expected_test_runs

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_zero_expected_test_runs(self):
        self.project.environments.create(slug='other_env', expected_test_runs=0)

        build = self.create_build('1')

        status = ProjectStatus.create_or_update(build)
        self.assertTrue(status.finished)
开发者ID:Linaro,项目名称:squad,代码行数:9,代码来源:test_project_status.py

示例11: test_maybe_notify_project_status

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_maybe_notify_project_status(self, send_status_notification):
        build = self.project1.builds.create(datetime=timezone.now())
        environment = self.project1.environments.create(slug='env')
        build.test_runs.create(environment=environment)
        status = ProjectStatus.create_or_update(build)

        maybe_notify_project_status(status.id)
        send_status_notification.assert_called_with(status)
开发者ID:Linaro,项目名称:squad,代码行数:10,代码来源:test_tasks_notification.py

示例12: test_send_notification_on_change_only

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
 def test_send_notification_on_change_only(self, diff):
     diff.return_value = fake_diff()
     self.project.subscriptions.create(
         email='[email protected]',
         notification_strategy=Subscription.NOTIFY_ON_CHANGE)
     status = ProjectStatus.create_or_update(self.build2)
     send_status_notification(status)
     self.assertEqual(1, len(mail.outbox))
开发者ID:Linaro,项目名称:squad,代码行数:10,代码来源:test_notification.py

示例13: test_send_notification_on_regression_only

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
 def test_send_notification_on_regression_only(self, regressions):
     regressions.return_value = OrderedDict({'key': 'value'})
     self.project.subscriptions.create(
         email='[email protected]',
         notification_strategy=Subscription.NOTIFY_ON_REGRESSION)
     status = ProjectStatus.create_or_update(self.build2)
     send_status_notification(status)
     self.assertEqual(1, len(mail.outbox))
开发者ID:Linaro,项目名称:squad,代码行数:10,代码来源:test_notification.py

示例14: test_maybe_notify_project_status_notify_patch_build_finished

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_maybe_notify_project_status_notify_patch_build_finished(self, notify_patch_build_finished):
        build = self.project1.builds.create(datetime=timezone.now())
        environment = self.project1.environments.create(slug='env')
        build.test_runs.create(environment=environment)
        status = ProjectStatus.create_or_update(build)

        maybe_notify_project_status(status.id)
        notify_patch_build_finished.delay.assert_called_with(build.id)
开发者ID:Linaro,项目名称:squad,代码行数:10,代码来源:test_tasks_notification.py

示例15: test_maybe_notify_project_status_schedule_timeout_not_requested

# 需要导入模块: from squad.core.models import ProjectStatus [as 别名]
# 或者: from squad.core.models.ProjectStatus import create_or_update [as 别名]
    def test_maybe_notify_project_status_schedule_timeout_not_requested(self, apply_async):
        build = self.project1.builds.create(datetime=timezone.now())
        environment = self.project1.environments.create(slug='env')
        build.test_runs.create(environment=environment)
        status = ProjectStatus.create_or_update(build)

        maybe_notify_project_status(status.id)
        apply_async.assert_not_called()
开发者ID:Linaro,项目名称:squad,代码行数:10,代码来源:test_tasks_notification.py


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