From: Harmon Date: Mon, 25 Oct 2021 07:57:07 +0000 (-0500) Subject: Improve Client.follow and Client.unfollow test to be more contained X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6606f83819eef7389804d9b03c6633efcf59b55d;p=tweepy.git Improve Client.follow and Client.unfollow test to be more contained Improve Client.follow and Client.unfollow test so as to be more contained and more easily reproducible --- diff --git a/cassettes/test_follow_and_unfollow.yaml b/cassettes/test_follow_and_unfollow.yaml index 910eb96..0f012bb 100644 --- a/cassettes/test_follow_and_unfollow.yaml +++ b/cassettes/test_follow_and_unfollow.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: null + body: '{"target_user_id": "17874544"}' headers: Accept: - '*/*' @@ -9,16 +9,21 @@ interactions: Connection: - keep-alive Content-Length: - - '0' + - '30' + Content-Type: + - application/json User-Agent: - - Python/3.9.1 Requests/2.25.1 Tweepy/3.10.0 - method: DELETE - uri: https://api.twitter.com/2/users/1072250532645998596/following/783214 + - Python/3.10.0 Requests/2.26.0 Tweepy/4.1.0 + method: POST + uri: https://api.twitter.com/2/users/1072250532645998596/following response: body: string: !!binary | - H4sIAAAAAAAAAKpWSkksSVSyqlZKy8/JyS/PzEtXskpLzClOra0FAAAA//8DAMXGczccAAAA + H4sIAAAAAAAAAKpWSkksSVSyqlZKy8/JyS/PzEtXsiopKk3VUSpIzUsBcuMhEkpWaYk5xam1tQAA + AAD//wMALpT8ejIAAAA= headers: + api-version: + - '2.27' cache-control: - no-cache, no-store, max-age=0 content-disposition: @@ -26,24 +31,24 @@ interactions: content-encoding: - gzip content-length: - - '54' + - '71' content-type: - application/json; charset=utf-8 date: - - Tue, 13 Apr 2021 03:49:50 GMT + - Mon, 25 Oct 2021 07:52:35 UTC server: - tsa_b set-cookie: - - personalization_id="v1_bro8VRa9TVemchH8zXuREQ=="; Max-Age=63072000; Expires=Thu, - 13 Apr 2023 03:49:50 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None - - guest_id=v1%3A161828579072987002; Max-Age=63072000; Expires=Thu, 13 Apr 2023 - 03:49:50 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None + - personalization_id="v1_JeRa4fUH+XKr493tcGfh1w=="; Max-Age=63072000; Expires=Wed, + 25 Oct 2023 07:52:35 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None + - guest_id=v1%3A163514835589009096; Max-Age=63072000; Expires=Wed, 25 Oct 2023 + 07:52:35 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None strict-transport-security: - max-age=631138519 x-access-level: - read-write-directmessages x-connection-hash: - - 1dbe7a102ae9486c2f9d34a19d8213d9 + - e38ef25bbc216b61fccac1fe1dc75ec4e23b2ceed34fb78a0d833dc3ca4bd603 x-content-type-options: - nosniff x-frame-options: @@ -53,16 +58,16 @@ interactions: x-rate-limit-remaining: - '49' x-rate-limit-reset: - - '1618286690' + - '1635149255' x-response-time: - - '52' + - '55' x-xss-protection: - '0' status: code: 200 message: OK - request: - body: '{"target_user_id": "783214"}' + body: null headers: Accept: - '*/*' @@ -71,21 +76,20 @@ interactions: Connection: - keep-alive Content-Length: - - '28' - Content-Type: - - application/json + - '0' Cookie: - - guest_id=v1%3A161828579072987002; personalization_id="v1_bro8VRa9TVemchH8zXuREQ==" + - guest_id=v1%3A163514835589009096; personalization_id="v1_JeRa4fUH+XKr493tcGfh1w==" User-Agent: - - Python/3.9.1 Requests/2.25.1 Tweepy/3.10.0 - method: POST - uri: https://api.twitter.com/2/users/1072250532645998596/following + - Python/3.10.0 Requests/2.26.0 Tweepy/4.1.0 + method: DELETE + uri: https://api.twitter.com/2/users/1072250532645998596/following/17874544 response: body: string: !!binary | - H4sIAAAAAAAAAKpWSkksSVSyqlZKy8/JyS/PzEtXsiopKk3VUSpIzUsBcuMhEkpWaYk5xam1tQAA - AAD//wMALpT8ejIAAAA= + H4sIAAAAAAAAAKpWSkksSVSyqlZKy8/JyS/PzEtXskpLzClOra0FAAAA//8DAMXGczccAAAA headers: + api-version: + - '2.27' cache-control: - no-cache, no-store, max-age=0 content-disposition: @@ -93,11 +97,11 @@ interactions: content-encoding: - gzip content-length: - - '71' + - '54' content-type: - application/json; charset=utf-8 date: - - Tue, 13 Apr 2021 03:49:50 GMT + - Mon, 25 Oct 2021 07:52:36 UTC server: - tsa_b strict-transport-security: @@ -105,7 +109,7 @@ interactions: x-access-level: - read-write-directmessages x-connection-hash: - - 1dbe7a102ae9486c2f9d34a19d8213d9 + - e38ef25bbc216b61fccac1fe1dc75ec4e23b2ceed34fb78a0d833dc3ca4bd603 x-content-type-options: - nosniff x-frame-options: @@ -115,11 +119,9 @@ interactions: x-rate-limit-remaining: - '49' x-rate-limit-reset: - - '1618286690' + - '1635149256' x-response-time: - - '51' - x-tsa-request-body-time: - - '5' + - '84' x-xss-protection: - '0' status: diff --git a/tests/test_client.py b/tests/test_client.py index a7bea72..e708086 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -94,9 +94,9 @@ class TweepyTestCase(unittest.TestCase): @tape.use_cassette("test_follow_and_unfollow.yaml", serializer="yaml") def test_follow_and_unfollow(self): - user_id = 783214 # User ID for @Twitter - self.client.unfollow(user_id) + user_id = 17874544 # User ID for @TwitterSupport self.client.follow(user_id) + self.client.unfollow(user_id) @tape.use_cassette("test_get_users_followers.yaml", serializer="yaml") def test_get_users_followers(self):