test_notifications.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:dsmr-reader 作者: dennissiemensma 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号