def test_view_message_on_receiver_side_and_spam(self):
        user = MagicMock(name="user")
        userMessageBuilder = UserMessageBuilder(user)

        self.user._id = 1
        self.message.author_id = 2
        self.message._spam = True

        with self.mock_preparation():
            self.assertFalse(
                    userMessageBuilder._viewable_message(self.message))
Esempio n. 2
0
    def test_view_message_on_receiver_side_and_spam(self):
        user = MagicMock(name="user")
        userMessageBuilder = UserMessageBuilder(user)

        self.user._id = 1
        self.message.author_id = 2
        self.message._spam = True

        with self.mock_preparation():
            self.assertFalse(userMessageBuilder._viewable_message(
                self.message))
Esempio n. 3
0
    def test_view_message_on_admin_and_del(self):
        user = MagicMock(name="user")
        userMessageBuilder = UserMessageBuilder(user)

        self.user._id = 1
        self.message.author_id = 2
        self.message.to_id = self.user._id
        self.message._spam = False
        self.message.del_on_recipient = True

        with self.mock_preparation(True):
            self.assertTrue(userMessageBuilder._viewable_message(self.message))
    def test_view_message_on_admin_and_del(self):
        user = MagicMock(name="user")
        userMessageBuilder = UserMessageBuilder(user)

        self.user._id = 1
        self.message.author_id = 2
        self.message.to_id = self.user._id
        self.message._spam = False
        self.message.del_on_recipient = True

        with self.mock_preparation(True):
            self.assertTrue(
                userMessageBuilder._viewable_message(self.message))