Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
adds tests for CreateSubscription
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylow committed Jan 30, 2016
1 parent 0f81c13 commit 7d8c92c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions testdata/post_create_subscription.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"user": {"contributors_enabled": false, "protected": false, "profile_use_background_image": false, "profile_background_tile": false, "favourites_count": 1279, "created_at": "Sun Sep 11 23:49:28 +0000 2011", "is_translation_enabled": false, "profile_background_color": "FFFFFF", "profile_link_color": "EE3355", "listed_count": 5, "friends_count": 306, "default_profile_image": false, "screen_name": "__jcbl__", "entities": {"description": {"urls": []}, "url": {"urls": [{"expanded_url": "http://iseverythingstilltheworst.com", "url": "http://t.co/wtg3XzqQTX", "indices": [0, 22], "display_url": "iseverythingstilltheworst.com"}]}}, "id": 372018022, "lang": "en", "location": "not a very good kingdom tbh", "statuses_count": 325, "profile_image_url_https": "https://pbs.twimg.com/profile_images/659691753826615298/yN1SoWrU_normal.jpg", "default_profile": false, "time_zone": "Eastern Time (US & Canada)", "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", "id_str": "372018022", "geo_enabled": false, "followers_count": 49, "has_extended_profile": false, "description": "my kingdom for a microwave that doesn't beep", "profile_sidebar_fill_color": "000000", "follow_request_sent": false, "is_translator": false, "verified": false, "name": "jeremy", "following": true, "url": "http://t.co/wtg3XzqQTX", "notifications": false, "profile_image_url": "http://pbs.twimg.com/profile_images/659691753826615298/yN1SoWrU_normal.jpg", "utc_offset": -18000, "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", "profile_text_color": "000000", "profile_sidebar_border_color": "000000"}, "member_count": 3, "id_str": "225486809", "slug": "my-bots", "created_at": "Tue Nov 10 16:43:07 +0000 2015", "uri": "/__jcbl__/lists/my-bots", "description": "", "full_name": "@__jcbl__/my-bots", "name": "my-bots", "following": false, "subscriber_count": 1, "mode": "public", "id": 225486809}
14 changes: 14 additions & 0 deletions tests/test_api_30.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,3 +1074,17 @@ def testDestroyList(self):
resp = self.api.DestroyList(list_id=233452137)
self.assertEqual(resp.id, 233452137)
self.assertEqual(resp.member_count, 0)

@responses.activate
def testCreateSubscription(self):
with open('testdata/post_create_subscription.json') as f:
resp_data = f.read()
responses.add(
responses.POST,
'https://api.twitter.com/1.1/lists/subscribers/create.json',
body=resp_data,
match_querystring=True,
status=200)
resp = self.api.CreateSubscription(list_id=225486809)
self.assertEqual(resp.id, 225486809)
self.assertEqual(resp.name, 'my-bots')

0 comments on commit 7d8c92c

Please sign in to comment.