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


Python Check.status方法代码示例

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


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

示例1: test_paused_check_is_not_in_grace_period

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_paused_check_is_not_in_grace_period(self):
        check = Check()

        check.status = "up"
        check.last_ping = timezone.now() - timedelta(days=1, minutes=30)
        self.assertTrue(check.in_grace_period())

        check.status = "paused"
        self.assertFalse(check.in_grace_period())
开发者ID:healthchecks,项目名称:healthchecks,代码行数:11,代码来源:test_check_model.py

示例2: test_status_works_with_grace_period

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_status_works_with_grace_period(self):
        check = Check()
        check.status = "up"
        check.last_ping = timezone.now() - timedelta(days=1, minutes=30)

        self.assertTrue(check.in_grace_period())
        self.assertEqual(check.get_status(), "up")
开发者ID:Persistent13,项目名称:healthchecks,代码行数:9,代码来源:test_check_model.py

示例3: test_next_ping_with_cron_syntax

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_next_ping_with_cron_syntax(self):
        dt = timezone.make_aware(datetime(2000, 1, 1), timezone=timezone.utc)

        # Expect ping every round hour
        check = Check()
        check.kind = "cron"
        check.schedule = "0 * * * *"
        check.status = "up"
        check.last_ping = dt

        d = check.to_dict()
        self.assertEqual(d["next_ping"], "2000-01-01T01:00:00+00:00")
开发者ID:cogzidel,项目名称:healthchecks,代码行数:14,代码来源:test_check_model.py

示例4: test_status_works_with_cron_syntax

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_status_works_with_cron_syntax(self):
        dt = timezone.make_aware(datetime(2000, 1, 1), timezone=timezone.utc)

        # Expect ping every midnight, default grace is 1 hour
        check = Check()
        check.kind = "cron"
        check.schedule = "0 0 * * *"
        check.status = "up"
        check.last_ping = dt

        # 00:30am
        now = dt + timedelta(days=1, minutes=30)
        self.assertEqual(check.get_status(now), "up")

        # 1:30am
        now = dt + timedelta(days=1, minutes=90)
        self.assertEqual(check.get_status(now), "down")
开发者ID:healthchecks,项目名称:healthchecks,代码行数:19,代码来源:test_check_model.py

示例5: test_it_sends_nag

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_it_sends_nag(self):
        check = Check(name="Test Check", user=self.alice)
        check.status = "down"
        check.last_ping = now()
        check.save()

        self.profile.nag_period = td(hours=1)
        self.profile.save()

        sent = self.profile.send_report(nag=True)
        self.assertTrue(sent)

        # And an email should have been sent
        self.assertEqual(len(mail.outbox), 1)
        message = mail.outbox[0]

        self.assertEqual(message.subject, 'Reminder: 1 check still down')
        self.assertIn("Test Check", message.body)
开发者ID:cogzidel,项目名称:healthchecks,代码行数:20,代码来源:test_profile.py

示例6: test_it_handles_few

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_it_handles_few(self, mock):
        yesterday = timezone.now() - timedelta(days=1)
        names = ["Check %d" % d for d in range(0, 10)]

        for name in names:
            check = Check(user=self.alice, name=name)
            check.alert_after = yesterday
            check.status = "up"
            check.save()

        result = handle_many()
        assert result, "handle_many should return True"

        handled_names = []
        for args, kwargs in mock.call_args_list:
            handled_names.append(args[0].name)

        assert set(names) == set(handled_names)
开发者ID:jjhuang,项目名称:healthchecks,代码行数:20,代码来源:test_sendalerts.py

示例7: test_status_works_with_timezone

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_status_works_with_timezone(self):
        dt = timezone.make_aware(datetime(2000, 1, 1), timezone=timezone.utc)

        # Expect ping every day at 10am, default grace is 1 hour
        check = Check()
        check.kind = "cron"
        check.schedule = "0 10 * * *"
        check.status = "up"
        check.last_ping = dt
        check.tz = "Australia/Brisbane"  # UTC+10

        # 10:30am
        now = dt + timedelta(days=1, minutes=30)
        self.assertEqual(check.get_status(now), "up")

        # 11:30am
        now = dt + timedelta(days=1, minutes=90)
        self.assertEqual(check.get_status(now), "down")
开发者ID:healthchecks,项目名称:healthchecks,代码行数:20,代码来源:test_check_model.py

示例8: test_it_handles_few

# 需要导入模块: from hc.api.models import Check [as 别名]
# 或者: from hc.api.models.Check import status [as 别名]
    def test_it_handles_few(self, mock):
        alice = User(username="alice")
        alice.save()

        names = ["Check %d" % d for d in range(0, 10)]

        for name in names:
            check = Check(user=alice, name=name)
            check.alert_after = datetime(2000, 1, 1)
            check.status = "up"
            check.save()

        result = handle_many()
        assert result, "handle_many should return True"

        handled_names = []
        for args, kwargs in mock.call_args_list:
            handled_names.append(args[0].name)

        assert set(names) == set(handled_names)
开发者ID:bobocola,项目名称:healthchecks,代码行数:22,代码来源:test_sendalerts.py


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