def test_save_tweet(self): status = 9999999999999999999999999 reimbursement = mixer.blend(Reimbursement, search_vector=None) command = Command() command.log = MagicMock() command.save_tweet(reimbursement, status) self.assertEqual(status, reimbursement.tweet.status) self.assertEqual(1, command.log.info.call_count) self.assertEqual(1, Tweet.objects.count())
def test_save_duplicated_tweet(self): status = 9999999999999999999999999 reimbursement = mixer.blend(Reimbursement) tweet = mixer.blend(Tweet, status=status, reimbursement=reimbursement) command = Command() command.log = MagicMock() command.save_tweet(reimbursement, status) self.assertEqual(status, reimbursement.tweet.status) self.assertEqual(1, command.log.info.call_count) self.assertEqual(1, Tweet.objects.count())