def test_should_notify_set(self):
""" Notifications: Test should_notify()'s output when service is set """
settings = NotificationSetting.get_solo()
settings.send_notification = True
settings.notification_service = NotificationSetting.NOTIFICATION_NMA
settings.save()
self.assertTrue(settings.send_notification)
# Should fail because we haven't set an API key
self.assertFalse(dsmr_notification.services.should_notify(settings))
settings.api_key = 'es7sh2d-DSMR-Reader-Rulez-iweu732'
settings.save()
self.assertTrue(dsmr_notification.services.should_notify(settings))
settings.next_notification = None
dsmr_notification.services.set_next_notification(
settings, timezone.make_aware(timezone.datetime(2116, 11, 16)))
self.assertFalse(dsmr_notification.services.should_notify(settings))
评论列表
文章目录