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)
Exemple #2
0
 def test_notifications_enabled(self):
     PushNotificationConfig(enabled=True).save()
     self.assertTrue(PushNotificationConfig.is_enabled())
Exemple #3
0
 def test_notifications_defaults(self):
     self.assertFalse(PushNotificationConfig.is_enabled())
Exemple #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)
Exemple #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)
Exemple #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)
def push_notification_enabled():
    """
    Returns whether the push notification feature is enabled.
    """
    return PushNotificationConfig.is_enabled()
Exemple #8
0
 def test_notifications_enabled(self):
     PushNotificationConfig(enabled=True).save()
     self.assertTrue(PushNotificationConfig.is_enabled())
Exemple #9
0
 def test_notifications_defaults(self):
     self.assertFalse(PushNotificationConfig.is_enabled())
def push_notification_enabled():
    """
    Returns whether the push notification feature is enabled.
    """
    return PushNotificationConfig.is_enabled()