示例#1
0
 def test_save(self):
     review = ReviewFactory(pk=None, title=None, slug=None)
     with patch('django.db.models.Model.save') as mock_save:
         review.save()
     self.assertEqual(review.title, review.get_title())
     self.assertEqual(review.slug, review.get_slug())
     mock_save.assert_called_once_with()
示例#2
0
 def test_save_published_review(self):
     review = ReviewFactory(is_published=True, published_on=None)
     with patch('django.db.models.Model.save') as mock_save:
         review.save()
     self.assertIsNotNone(review.published_on)
     mock_save.assert_called_once_with()