示例#1
0
 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])
示例#2
0
 def test_new_timestamp_must_be_datetime(self):
     message = Message(
      "memento mori", datetime(2011, 3, 1, 12, 34, 32), self.contact1
     )
     with self.assertRaises(TypeError):
         message.timestamp(1000)
     with self.assertRaises(TypeError):
         message.timestamp(datetime(2012, 1, 19, 9, 23, 56).date())
示例#3
0
 def test_can_update_message_timestamp(self):
     message = Message(
      "memento mori", datetime(2011, 3, 1, 12, 34, 32), self.contact1
     )
     message.timestamp(datetime(2012, 1, 19, 9, 23, 56))
     self.assertEqual(message._timestamp, datetime(2012, 1, 19, 9, 23, 56))
示例#4
0
 def test_message_timestamp(self):
     message = Message(
      "memento mori", datetime(2011, 3, 1, 12, 34, 32), self.contact1
     )
     self.assertIs(message._timestamp, message.timestamp())