def test_extract_urls_with_url_without_retweeted_status():
    expected_url = ['url']

    call_response = MagicMock(entities=_entities)

    urls = Tweets.extract_urls(call_response)

    assert expected_url == urls
def _tweets(mock_tweet_cache_loader, mock_tweet_cacher):
    mock_twitter_api = MagicMock()
    tweets = Tweets(mock_twitter_api, 'screen_name')

    assert tweets
    assert mock_twitter_api == tweets._twitter_api
    assert 'screen_name' == tweets.screen_name

    return tweets
def test_extract_urls_without_url_with_retweeted_status():
    expected_url = ['url']
    entities = {
        'urls': [],
    }
    retweeted_status = MagicMock(entities=_retweeted_entities)
    call_response = MagicMock(entities=entities,
                              retweeted_status=retweeted_status)

    urls = Tweets.extract_urls(call_response)

    assert expected_url == urls
 def _fetch(self, tweet_type):
     tweets = Tweets(self.api, self.screen_name, tweet_type=tweet_type)
     return tweets.get()
def test_remove_ignore_urls():
    urls = ['https://twitter.com/dev3l_', 'url', 'url2']

    assert ['url', 'url2'] == Tweets._remove_ignore_urls(urls)