Ejemplo n.º 1
0
def test_search_tweets(samp_auth):
    """
    Test the tweets_search method.
    """

    for query in TEST_QUERY:
        params = {"q": query, "result_type": "recent"}
        _, meta = rest.search_tweets(samp_auth, **params)
        assert meta["code"] == 200
Ejemplo n.º 2
0
def test_search_tweets(samp_auth):
    """
    Test the tweets_search method.
    """

    for query in TEST_QUERY:
        params = {"q": query, "result_type": "recent"}
        _, meta = rest.search_tweets(samp_auth, **params)
        assert meta["code"] == 200
Ejemplo n.º 3
0
def test_search_tweets_iter(samp_auth):
    """
    Test the tweets_search method w/ id_iter.
    """

    for query in TEST_QUERY:
        params = {"q": query, "result_type": "recent", "count": 10,
                  "maxitems": 20}
        results = []
        for data, meta in rest.search_tweets(samp_auth, **params):
            assert meta["code"] == 200
            results.extend(data["statuses"])
        assert len(results) >= 20
        assert len(set(r["id"] for r in results)) >= 20
Ejemplo n.º 4
0
def test_search_tweets_iter(samp_auth):
    """
    Test the tweets_search method w/ id_iter.
    """

    for query in TEST_QUERY:
        params = {
            "q": query,
            "result_type": "recent",
            "count": 10,
            "maxitems": 20
        }
        results = []
        for data, meta in rest.search_tweets(samp_auth, **params):
            assert meta["code"] == 200
            results.extend(data["statuses"])
        assert len(results) >= 20
        assert len(set(r["id"] for r in results)) >= 20