示例#1
0
文件: tests.py 项目: rwisecar/Pyphon
 def test_most_recent_text_body(self):
     """test that most_recent_text_body helper function returns the right text body."""
     contact = Contact(name="test", number='+12345678910')
     contact.save()
     text = Text(body="this is a test", sender="Them", contact=contact)
     text.save()
     self.assertEqual(contact.most_recent_text_body(), text.body)
示例#2
0
文件: tests.py 项目: rwisecar/Pyphon
 def test_most_recent_text_body_longer_body(self):
     """Test helper function returns truncated text body."""
     contact = Contact(name="test", number='+12345678910')
     contact.save()
     text = Text(body="this is a sample text for testing",
                 sender="Them",
                 contact=contact)
     text.save()
     truncated_text = "this is a sample tex..."
     self.assertEqual(contact.most_recent_text_body(), truncated_text)