Exemplo n.º 1
0
 def test_can_remove_messages(self):
     conversation = Conversation()
     for message in self.messages:
         conversation.add_message(message)
     conversation.remove_message(self.messages[-1])
     self.assertEqual(conversation._messages, self.messages[:-1])
     conversation.remove_message(self.messages[0])
     self.assertEqual(conversation._messages, self.messages[1:-1])
     conversation.remove_message(self.messages[2])
     self.assertEqual(
      conversation._messages,
      [self.messages[1], self.messages[3]]
     )
Exemplo n.º 2
0
 def test_removing_messages_resets_message_conversation_to_none(self):
     conversation = Conversation()
     conversation.add_message(self.messages[0])
     self.assertIs(self.messages[0]._conversation, conversation)
     conversation.remove_message(self.messages[0])
     self.assertIs(self.messages[0]._conversation, None)