def test_get_quoted_tweet_caches(self, get_method): "Should only fetch quoted Tweet from DB once." quoted_tweet = TweetFactory(text='The quote!', twitter_id=123) tweet = TweetFactory(quoted_status_id=123) tweet.get_quoted_tweet() tweet.get_quoted_tweet() self.assertEqual(get_method.call_count, 1)
def test_get_quoted_tweet_none(self): tweet = TweetFactory(quoted_status_id=None) self.assertIsNone(tweet.get_quoted_tweet())
def test_get_quoted_tweet(self): quoted_tweet = TweetFactory(text='The quote!', twitter_id=123) tweet = TweetFactory(quoted_status_id=123) self.assertEqual(tweet.get_quoted_tweet().text, 'The quote!')