def test_updating_timestamp_will_make_message_rearrange_in_conversation(self, mock_sort): message = Message( "memento mori", datetime(2011, 3, 1, 12, 34, 32), self.contact1 ) message._conversation = Mock(Conversation) message._conversation._messages = [message] message.timestamp(datetime(2012, 1, 19, 9, 23, 56)) mock_sort.assert_called_with([message])
def test_message_recipients_is_conversation_participants_without_sender(self): message = Message( "memento mori", datetime(2011, 3, 1, 12, 34, 32), self.contact1 ) conversation = Mock(Conversation) conversation.participants.return_value = set( [self.contact1, self.contact2, self.contact3] ) message._conversation = conversation self.assertEqual( message.recipients(), set([self.contact2, self.contact3]) )
def test_message_conversation(self): message = Message( "memento mori", datetime(2011, 3, 1, 12, 34, 32), self.contact1 ) message._conversation = "A conversation" self.assertIs(message._conversation, message.conversation())