forked from GithubBackups/healthchecks
19 lines
555 B
Python
19 lines
555 B
Python
from datetime import timedelta
|
|
|
|
from django.utils import timezone
|
|
from hc.api.management.commands.sendalerts import Command
|
|
from hc.api.models import Check
|
|
from hc.test import BaseTestCase
|
|
|
|
|
|
class SendAlertsTestCase(BaseTestCase):
|
|
|
|
def test_it_handles_grace_period(self):
|
|
check = Check(user=self.alice, status="up")
|
|
# 1 day 30 minutes after ping the check is in grace period:
|
|
check.last_ping = timezone.now() - timedelta(days=1, minutes=30)
|
|
check.save()
|
|
|
|
# Expect no exceptions--
|
|
Command().handle_one()
|