def test_content(self): post = Post(title='hello world', text='world', slug='hello-world', author_id=1) self.assertEqual(post.content, '<p>%s</p>\n' % post.text) post.text = 'new world' self.assertEqual(post.content, '<p>%s</p>\n' % post.text)
def test_date(self): post = Post(title='hello world', text='world', slug='hello-world', author_id=1) self.assertIsNone(post.created_at) self.assertIsNone(post.updated_at) self.session.add(post) self.session.commit() self.assertIsNotNone(post.created_at) self.assertIsNone(post.updated_at) post.text = 'new world' self.session.commit() self.assertIsNotNone(post.updated_at)