def test_ensure_triggers(self):
        Command().handle()

        check = Check.objects.create()
        assert check.alert_after is None

        check.last_ping = timezone.now()
        check.save()
        check.refresh_from_db()
        assert check.alert_after is not None
        alert_after = check.alert_after

        check.last_ping += timedelta(days=1)
        check.save()
        check.refresh_from_db()
        assert check.alert_after > alert_after
    def test_ensure_triggers(self):
        Command().handle()
        check = Check.objects.create()

        self.assertEqual(check.alert_after, None)

        check.last_ping = timezone.now()
        check.save()
        check.refresh_from_db()

        self.assertNotEqual(check.alert_after,None)

        alert_after = check.alert_after
        check.last_ping += timedelta(days=1)
        check.save()
        check.refresh_from_db()
                
        self.assertLess(alert_after, check.alert_after)
Exemple #3
0
    def test_ensure_triggers(self):
        Command().handle()

        check = Check.objects.create()
        assert check.alert_after is None

        check.last_ping = timezone.now()
        check.save()
        check.refresh_from_db()
        assert check.alert_after is not None
        ### The above assert fails. Make it pass

        alert_after = check.alert_after

        check.last_ping += timedelta(days=1)
        check.save()
        check.refresh_from_db()
        ### Assert that alert_after is lesser than the check's alert_after
        self.assertLess(alert_after, check.alert_after)
Exemple #4
0
    def test_ensure_triggers(self):
        Command().handle()

        check = Check.objects.create()
        assert check.alert_after is None

        check.last_ping = timezone.now()
        check.save()
        check.refresh_from_db()
        assert check.alert_after is not None
        ### The above assert fails. Make it pass
        #The assert passes because by now indexing h as occured due to the refresh_from_db above

        alert_after = check.alert_after

        check.last_ping += timedelta(days=1)
        check.save()
        check.refresh_from_db()
        ### Assert that alert_after is lesser than the check's alert_after
        self.assertTrue(alert_after < check.alert_after)
    def test_ensure_triggers(self):
        Command().handle()

        check = Check.objects.create()
        assert check.alert_after is None
        self.assertIsNone(check.alert_after, msg=None)

        check.last_ping = timezone.now()
        check.save()
        check.refresh_from_db()
        assert check.alert_after is not None
        self.assertIsNotNone(check.alert_after, msg=None)

        alert_after = check.alert_after

        check.last_ping += timedelta(days=1)
        check.save()
        check.refresh_from_db()
        alert_after_refresh = check.alert_after
        #Test that alert_after is lesser than the check's alert_after
        assert alert_after_refresh > alert_after