예제 #1
0
 def test_notifications_error_from_parse(self, mock_parse_push,
                                         mock_log_exception):
     PushNotificationConfig(enabled=True).save()
     from parse_rest.core import ParseError
     mock_parse_push.alert.side_effect = ParseError
     self.post_course_update(send_push_notification=True)
     self.assertTrue(mock_log_exception.called)
예제 #2
0
 def test_notifications_enabled(self):
     PushNotificationConfig(enabled=True).save()
     self.assertTrue(PushNotificationConfig.is_enabled())
예제 #3
0
 def test_notifications_defaults(self):
     self.assertFalse(PushNotificationConfig.is_enabled())
예제 #4
0
 def test_notifications_sent_to_parse(self, mock_parse_push):
     PushNotificationConfig(enabled=True).save()
     self.post_course_update(send_push_notification=True)
     self.assertEquals(mock_parse_push.alert.call_count, 2)
예제 #5
0
 def test_notifications_enabled_and_sent(self, mock_push_update):
     PushNotificationConfig(enabled=True).save()
     self.post_course_update(send_push_notification=True)
     self.assertTrue(mock_push_update.called)
예제 #6
0
 def test_notifications_enabled_but_not_requested(self, mock_push_update):
     PushNotificationConfig(enabled=True).save()
     self.post_course_update()
     self.assertFalse(mock_push_update.called)
예제 #7
0
def push_notification_enabled():
    """
    Returns whether the push notification feature is enabled.
    """
    return PushNotificationConfig.is_enabled()
예제 #8
0
 def test_notifications_enabled(self):
     PushNotificationConfig(enabled=True).save()
     self.assertTrue(PushNotificationConfig.is_enabled())
예제 #9
0
 def test_notifications_defaults(self):
     self.assertFalse(PushNotificationConfig.is_enabled())
예제 #10
0
def push_notification_enabled():
    """
    Returns whether the push notification feature is enabled.
    """
    return PushNotificationConfig.is_enabled()