コード例 #1
0
def test_process_tweet_for_quoted_tweet(test_status):
    """Verify process_tweet method returns Tweet"""
    test_tweet = test_status("quoted_tweet")
    tweet = process_tweet(
        status=test_tweet, excluded_ids=["1218223881045139457", "1217726499781873664"],
    )
    assert type(tweet) == Tweet
コード例 #2
0
def test_process_tweet_for_bot_tweet(test_status):
    """Verify process_tweet method returns None

    The process_tweet method returns None for a tweet that is created by bot user.
    """
    test_tweet = test_status("quote_bot_status")
    tweet = process_tweet(status=test_tweet)
    assert not tweet
コード例 #3
0
def test_process_tweet_from_excluded_list(test_status):
    """Verify process_tweet method returns None

    The process_tweet method returns None for a tweet that is in the excluded_ids list.
    """
    test_tweet = test_status("quoted_tweet")
    tweet = process_tweet(status=test_tweet, excluded_ids=["1236873389073141760"])
    assert not tweet
コード例 #4
0
def test_process_tweet_for_tweet_already_quoted_by_user(test_status):
    """Verify process_tweet method returns None

    The process_tweet method returns None for a tweet that
    quotes a tweet that has already been quoted in same thread.
    """
    test_tweet = test_status("quoted_tweets_for_tweeted_already_quoted_by_user")
    tweet = process_tweet(status=test_tweet, excluded_ids=["1243010309067071489"])
    assert not tweet
コード例 #5
0
def test_process_tweet_for_user_for_users_own_tweet(test_status):
    """Verify process_tweet method returns None

    The process_tweet method returns None for a tweet that quotes the user's own tweet.
    """
    test_tweet = test_status("quote_users_own_status")
    quoted_retweets = process_tweet(
        status=test_tweet, excluded_ids=["1218223881045139457", "1217726499781873664"],
    )
    assert not quoted_retweets
コード例 #6
0
def test_process_tweet_for_user_for_non_retweet(test_status):
    """Verify get_recent_quoted_retweets_for_user method returns None

    The process_tweet method returns None for a tweet that is not a retweet.
    """
    test_tweet = test_status("basic_tweet")
    quoted_retweets = process_tweet(
        status=test_tweet, excluded_ids=["1218223881045139457", "1217726499781873664"],
    )
    assert not quoted_retweets
コード例 #7
0
def test_process_tweet_for_tweet_with_none_reply_status_id(test_status):
    """Verify process_tweet method returns tweet"""
    test_tweet = test_status("basic_quoted_tweet")
    tweet = process_tweet(status=test_tweet)

    assert type(tweet) == Tweet
    assert not tweet.replied_to_status_id
    assert tweet.user == test_tweet.user.screen_name
    assert tweet.quoted_tweet_id == test_tweet.quoted_status.id
    assert tweet.tweet_str == f"@{test_tweet.user.screen_name}: {test_tweet.text}"
    assert tweet.raw_tweet.quoted_status == test_tweet.quoted_status
    assert tweet.id == test_tweet.id
コード例 #8
0
def test_process_tweet_for_different_tweets_quoted_by_user_in_same_thread(test_status):
    """Verify process_tweet method returns Tweet object

    If a user starts a thread by quoting a tweet and then later in the thread
    the user quotes a different tweet both tweets should be collected.
    """
    test_tweets = test_status("quoted_different_tweets_in_same_thread")
    excluded_ids = ["1243010309067071489"]
    for test_tweet in test_tweets:
        tweet = process_tweet(status=test_tweet, excluded_ids=excluded_ids)
        assert tweet
        excluded_ids.append(tweet.id_str)