예제 #1
0
    def test_no_reply_notifications_for_inactive_users(self):
        author = create_user()

        comment = create_comment(author=author)

        action_func_list = [Actions.remixed,
                            Actions.replied,
                            Actions.thread_replied]

        # First make sure that the user can receive all possible "comment"
        # related notifications, like replied, remixed ... etc
        for func in action_func_list:
            pending_notification = func(author, comment)
            self.assertTrue(EmailChannel.enabled_for_recipient_action(pending_notification.action,
                                                             author,
                                                             pending_notification))

        author.is_active = False

        author.save()
        for func in action_func_list:
            pending_notification = func(author, comment)
            self.assertFalse(EmailChannel.enabled_for_recipient_action(pending_notification.action,
                                                             author,
                                                             pending_notification))
    def test_no_reply_notifications_for_inactive_users(self):
        author = create_user()

        comment = create_comment(author=author)

        action_func_list = [Actions.remixed,
                            Actions.replied,
                            Actions.thread_replied]

        # First make sure that the user can receive all possible "comment"
        # related notifications, like replied, remixed ... etc
        for func in action_func_list:
            pending_notification = func(author, comment)
            self.assertTrue(EmailChannel.enabled_for_recipient_action(pending_notification.action,
                                                             author,
                                                             pending_notification))

        author.is_active = False

        author.save()
        for func in action_func_list:
            pending_notification = func(author, comment)
            self.assertFalse(EmailChannel.enabled_for_recipient_action(pending_notification.action,
                                                             author,
                                                             pending_notification))
예제 #3
0
    def test_not_enabled_if_user_has_no_email(self):
        user = create_user(email="*****@*****.**")
        for action in EmailChannel.recipient_actions:
            assert EmailChannel.enabled_for_recipient_action(action, user)
        for action in EmailChannel.actor_actions:
            assert EmailChannel.enabled_for_actor_action(action, user)

        user.email = ""
        user.save()

        for action in EmailChannel.recipient_actions:
            assert not EmailChannel.enabled_for_recipient_action(action, user)
        for action in EmailChannel.actor_actions:
            assert not EmailChannel.enabled_for_actor_action(action, user)
예제 #4
0
    def test_not_enabled_if_user_has_no_email(self):
        user = create_user(email="*****@*****.**")
        for action in EmailChannel.recipient_actions:
            assert EmailChannel.enabled_for_recipient_action(action, user)
        for action in EmailChannel.actor_actions:
            assert EmailChannel.enabled_for_actor_action(action, user)

        user.email = ""
        user.save()

        for action in EmailChannel.recipient_actions:
            assert not EmailChannel.enabled_for_recipient_action(action, user)
        for action in EmailChannel.actor_actions:
            assert not EmailChannel.enabled_for_actor_action(action, user)