From c225f78e4c28dfb3be4165cc9a50039385769855 Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 27 Sep 2021 14:00:50 -0500 Subject: [PATCH] Add test for Client.get_all_tweets_count --- cassettes/test_get_all_tweets_count.yaml | 143 +++++++++++++++++++++++ tests/test_client.py | 4 +- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 cassettes/test_get_all_tweets_count.yaml diff --git a/cassettes/test_get_all_tweets_count.yaml b/cassettes/test_get_all_tweets_count.yaml new file mode 100644 index 0000000..a506f2a --- /dev/null +++ b/cassettes/test_get_all_tweets_count.yaml @@ -0,0 +1,143 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - Python/3.9.6 Requests/2.25.1 Tweepy/4.0.0 + method: GET + uri: https://api.twitter.com/2/tweets/counts/all?query=Tweepy + response: + body: + string: !!binary | + H4sIAAAAAAAAAJTdwY7kdnLE4XeZs2Q0OdPd03oOn7xYLASvbvYuYM/CB0Hvbs3UqTuD/CIBHYf5 + SyT/kRXFYod+//T3X7/9+umXv/z+6bd//P3TL5/Op/P4+enrz+fXf386fnl6+vO/f3t6evqPTz99 + +t9vv/7Ptw//5On9P/n2f7/99u1v//nPf/3jz394/PFTqnq66rGv+tlVz5uqZ676xVU/76s+u+qX + fdUXV32+qfo5V3111Zd91a+u+ro/A2+u+nVd9Xhy1bf13TqsrY/gpqq19RHcTMDa+ghuerW2PoKb + qtbWR3BT1dr6CG7mam19BDdVra2P4KaqtfURXMz1tLY+goteT2vrI7jp1dr6CH5X9Uuuam19BHMC + b+NjOVW901ba2m/2AxPc9Kq5TjDv1pv9wAQ3vWpnTXBTVTtrgpsJaGdNcNOrdtYEN1W1sya4qaqd + NcGFCugHJri4W/QDE9xUtbbWfuDNfmCCm16trVs/cNGrtXXrB9LWfrMfmOCmqrW19gNv9gMT3Nwt + a+vWD+Re6QcmuOiVfmCCm16trVs/kLcL/cAEq9fPT/YD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1draBhKdDigMYD53 + cUBhADcTsLa2AQSnAwoDuFAs/QACCi+qWlvr3wscUBjARa/0AwgozNuFfgABhRcTsLa2gUSnAwoD + +F3VEBlyOqAwgJteNVcEFF5U1Vz3AYWnAwoDuKmqnbUPKDwdUBjA1JYDCgP4XdX0DrQDCgO4mYB2 + FgIK8wToBxBQeFHV2tr+DwxOBxQGMB2RAwoDuFAB/QACCi+qWlvr5wMOKAzg5m5ZW7d+4OJuWVtr + P/Cj6vPXXz5/uat6/3vBX3/69N+/ffv10y+/f/r2z2+//tff3iv69fj6xx//DwAA//8DAIRjJBty + +AAA + headers: + api-version: + - '2.26' + cache-control: + - no-cache, no-store, max-age=0 + content-disposition: + - attachment; filename=json.json + content-encoding: + - gzip + content-length: + - '4620' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Sep 2021 18:58:44 UTC + server: + - tsa_b + set-cookie: + - personalization_id="v1_FvrjqtjOSbhbGWjaoMt18A=="; Max-Age=63072000; Expires=Wed, + 27 Sep 2023 18:58:44 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None + - guest_id=v1%3A163276912491516098; Max-Age=63072000; Expires=Wed, 27 Sep 2023 + 18:58:44 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None + strict-transport-security: + - max-age=631138519 + x-access-level: + - read + x-connection-hash: + - e4e59016b7af087be55e6be21090ab2c4c452f9ea695d5c70839f3c37ba05b4f + x-content-type-options: + - nosniff + x-frame-options: + - SAMEORIGIN + x-rate-limit-limit: + - '300' + x-rate-limit-remaining: + - '299' + x-rate-limit-reset: + - '1632770024' + x-xss-protection: + - '0' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_client.py b/tests/test_client.py index dd83404..dbd3222 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -65,7 +65,9 @@ class TweepyTestCase(unittest.TestCase): user_id = 783214 # User ID for @Twitter self.client.get_users_tweets(user_id) - # TODO: test_get_all_tweets_count with access to Academic Research product track + @tape.use_cassette("test_get_all_tweets_count.yaml", serializer="yaml") + def test_get_all_tweets_count(self): + self.client.get_all_tweets_count("Tweepy") @tape.use_cassette("test_get_recent_tweets_count.yaml", serializer="yaml") def test_get_recent_tweets_count(self): -- 2.25.1