diff --git a/.travis.yml b/.travis.yml index 89a3583..eb88c4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,8 @@ env: - PROTECTED_TWITTER_1=TwythonSecure1 - PROTECTED_TWITTER_2=TwythonSecure2 - TEST_TWEET_ID=332992304010899457 - - TEST_LIST_ID=574 + - TEST_LIST_SLUG=team + - TEST_LIST_OWNER_SCREEN_NAME=twitterapi install: pip install -r requirements.txt script: nosetests -v -w tests/ --logging-filter="twython" --with-cov --cov twython --cov-config .coveragerc --cov-report term-missing notifications: diff --git a/tests/config.py b/tests/config.py index af098cd..4e8895e 100644 --- a/tests/config.py +++ b/tests/config.py @@ -16,7 +16,8 @@ protected_twitter_2 = os.environ.get('PROTECTED_TWITTER_2', 'TwythonSecure2') # Test Ids test_tweet_id = os.environ.get('TEST_TWEET_ID', '318577428610031617') -test_list_id = os.environ.get('TEST_LIST_ID', '574') # 574 is @twitter/team +test_list_slug = os.environ.get('TEST_LIST_SLUG', 'team') +test_list_owner_screen_name = os.environ.get('TEST_LIST_OWNER_SCREEN_NAME', 'twitterapi') test_tweet_object = {u'contributors': None, u'truncated': False, u'text': u'http://t.co/FCmXyI6VHd is a #cool site, lol! @mikehelmick should #checkitout. If you can! #thanks Love, @__twython__ https://t.co/67pwRvY6z9', u'in_reply_to_status_id': None, u'id': 349683012054683648, u'favorite_count': 0, u'source': u'web', u'retweeted': False, u'coordinates': None, u'entities': {u'symbols': [], u'user_mentions': [{u'id': 29251354, u'indices': [45, 57], u'id_str': u'29251354', u'screen_name': u'mikehelmick', u'name': u'Mike Helmick'}, {u'id': 1431865928, u'indices': [104, 116], u'id_str': u'1431865928', u'screen_name': u'__twython__', u'name': u'Twython'}], u'hashtags': [{u'indices': [28, 33], u'text': u'cool'}, {u'indices': [65, 76], u'text': u'checkitout'}, {u'indices': [90, 97], u'text': u'thanks'}], u'urls': [{u'url': u'http://t.co/FCmXyI6VHd', u'indices': [0, 22], u'expanded_url': u'http://google.com', u'display_url': u'google.com'}, {u'url': u'https://t.co/67pwRvY6z9', u'indices': [117, 140], u'expanded_url': u'https://github.com', u'display_url': u'github.com'}]}, u'in_reply_to_screen_name': None, u'id_str': u'349683012054683648', u'retweet_count': 0, u'in_reply_to_user_id': None, u'favorited': False, u'user': {u'follow_request_sent': False, u'profile_use_background_image': True, u'default_profile_image': True, u'id': 1431865928, u'verified': False, u'profile_text_color': u'333333', u'profile_image_url_https': u'https://si0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png', u'profile_sidebar_fill_color': u'DDEEF6', u'entities': {u'description': {u'urls': []}}, u'followers_count': 1, u'profile_sidebar_border_color': u'C0DEED', u'id_str': u'1431865928', u'profile_background_color': u'3D3D3D', u'listed_count': 0, u'profile_background_image_url_https': u'https://si0.twimg.com/images/themes/theme1/bg.png', u'utc_offset': None, u'statuses_count': 2, u'description': u'', u'friends_count': 1, u'location': u'', u'profile_link_color': u'0084B4', u'profile_image_url': u'http://a0.twimg.com/sticky/default_profile_images/default_profile_3_normal.png', u'following': False, u'geo_enabled': False, u'profile_background_image_url': u'http://a0.twimg.com/images/themes/theme1/bg.png', u'screen_name': u'__twython__', u'lang': u'en', u'profile_background_tile': False, u'favourites_count': 0, u'name': u'Twython', u'notifications': False, u'url': None, u'created_at': u'Thu May 16 01:11:09 +0000 2013', u'contributors_enabled': False, u'time_zone': None, u'protected': False, u'default_profile': False, u'is_translator': False}, u'geo': None, u'in_reply_to_user_id_str': None, u'possibly_sensitive': False, u'lang': u'en', u'created_at': u'Wed Jun 26 00:18:21 +0000 2013', u'in_reply_to_status_id_str': None, u'place': None} test_tweet_html = 'google.com is a #cool site, lol! @mikehelmick should #checkitout. If you can! #thanks Love, @__twython__ github.com' diff --git a/tests/test_core.py b/tests/test_core.py index c0ae08b..b54f729 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -3,8 +3,8 @@ from twython import Twython, TwythonError, TwythonAuthError from .config import ( app_key, app_secret, oauth_token, oauth_token_secret, protected_twitter_1, protected_twitter_2, screen_name, - test_tweet_id, test_list_id, access_token, test_tweet_object, - test_tweet_html + test_tweet_id, test_list_slug, test_list_owner_screen_name, + access_token, test_tweet_object, test_tweet_html ) import time @@ -361,7 +361,8 @@ class TwythonAPITestCase(unittest.TestCase): def test_get_list_statuses(self): """Test timeline of tweets authored by members of the specified list succeeds""" - self.api.get_list_statuses(list_id=test_list_id) + self.api.get_list_statuses(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name) def test_create_update_destroy_list_add_remove_list_members(self): """Test create a list, adding and removing members then @@ -386,28 +387,36 @@ class TwythonAPITestCase(unittest.TestCase): def test_get_list_subscribers(self): """Test list of subscribers of a specific list succeeds""" - self.api.get_list_subscribers(list_id=test_list_id) + self.api.get_list_subscribers(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name) def test_subscribe_is_subbed_and_unsubscribe_to_list(self): """Test subscribing, is a list sub and unsubbing to list succeeds""" - self.api.subscribe_to_list(list_id=test_list_id) + self.api.subscribe_to_list(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name) # Returns 404 if user is not a subscriber - self.api.is_list_subscriber(list_id=test_list_id, + self.api.is_list_subscriber(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name, screen_name=screen_name) - self.api.unsubscribe_from_list(list_id=test_list_id) + self.api.unsubscribe_from_list(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name) def test_is_list_member(self): """Test returning if specified user is member of a list succeeds""" # Returns 404 if not list member - self.api.is_list_member(list_id=test_list_id, screen_name='jack') + self.api.is_list_member(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name, + screen_name='themattharris') def test_get_list_members(self): """Test listing members of the specified list succeeds""" - self.api.get_list_members(list_id=test_list_id) + self.api.get_list_members(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name) def test_get_specific_list(self): """Test getting specific list succeeds""" - self.api.get_specific_list(list_id=test_list_id) + self.api.get_specific_list(slug=test_list_slug, + owner_screen_name=test_list_owner_screen_name) def test_get_list_subscriptions(self): """Test collection of the lists the specified user is