Attempting to exclude lines that we can't necessarily hit in tests, added a test, fixed function name
update_profile_background_image has been in endpoints.py twice for a bit, my bad. Using update_profile_banner_image for the function name to update profile banner image (that's what it was called previously)
This commit is contained in:
parent
672c8db77e
commit
7cab9d5dd1
7 changed files with 27 additions and 28 deletions
|
|
@ -1,2 +1,8 @@
|
|||
[run]
|
||||
omit = twython/advisory.py
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
pragma: no cover
|
||||
|
||||
def __repr__
|
||||
|
|
|
|||
|
|
@ -104,6 +104,11 @@ class TwythonAPITestCase(unittest.TestCase):
|
|||
self.assertRaises(TwythonAuthError, self.api.get_user_timeline,
|
||||
screen_name=protected_twitter_2)
|
||||
|
||||
def test_retweeted_of_me(self):
|
||||
"""Test that getting recent tweets by authenticated user that have
|
||||
been retweeted by others succeeds"""
|
||||
self.api.retweeted_of_me()
|
||||
|
||||
def test_get_home_timeline(self):
|
||||
"""Test returning home timeline for authenticated user succeeds"""
|
||||
self.api.get_home_timeline()
|
||||
|
|
|
|||
|
|
@ -16,18 +16,6 @@ class TwythonStreamTestCase(unittest.TestCase):
|
|||
def on_error(self, status_code, data):
|
||||
raise TwythonStreamError(data)
|
||||
|
||||
def on_delete(self, data):
|
||||
return
|
||||
|
||||
def on_limit(self, data):
|
||||
return
|
||||
|
||||
def on_disconnect(self, data):
|
||||
return
|
||||
|
||||
def on_timeout(self, data):
|
||||
return
|
||||
|
||||
self.api = MyStreamer(app_key, app_secret,
|
||||
oauth_token, oauth_token_secret)
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.post('statuses/retweet/%s' % params.get('id'))
|
||||
|
||||
def update_status_with_media(self, **params):
|
||||
def update_status_with_media(self, **params): # pragma: no cover
|
||||
"""Updates the authenticating user's current status and attaches media
|
||||
for upload. In other words, it creates a Tweet with a picture attached.
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.post('account/update_profile', params=params)
|
||||
|
||||
def update_profile_background_image(self, **params):
|
||||
def update_profile_banner_image(self, **params): # pragma: no cover
|
||||
"""Updates the authenticating user's profile background image.
|
||||
|
||||
Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image
|
||||
|
|
@ -340,7 +340,7 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.post('account/update_profile_colors', params=params)
|
||||
|
||||
def update_profile_image(self, **params):
|
||||
def update_profile_image(self, **params): # pragma: no cover
|
||||
"""Updates the authenticating user's profile image.
|
||||
|
||||
Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_image
|
||||
|
|
@ -431,13 +431,13 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.post('account/remove_profile_banner', params=params)
|
||||
|
||||
def update_profile_Background_image(self, **params):
|
||||
def update_profile_background_image(self, **params):
|
||||
"""Uploads a profile banner on behalf of the authenticating user.
|
||||
|
||||
Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner
|
||||
|
||||
"""
|
||||
return self.post('ccount/update_profile_background_image', params=params)
|
||||
return self.post('account/update_profile_background_image', params=params)
|
||||
|
||||
def get_profile_banner_sizes(self, **params):
|
||||
"""Returns a map of the available size variations of the specified user's profile banner.
|
||||
|
|
@ -712,7 +712,7 @@ class EndpointsMixin(object):
|
|||
"""
|
||||
return self.get('geo/similar_places', params=params)
|
||||
|
||||
def create_place(self, **params):
|
||||
def create_place(self, **params): # pragma: no cover
|
||||
"""Creates a new place object at the given latitude and longitude.
|
||||
|
||||
Docs: https://dev.twitter.com/docs/api/1.1/post/geo/place
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class TwythonError(Exception):
|
|||
super(TwythonError, self).__init__(msg)
|
||||
|
||||
@property
|
||||
def msg(self):
|
||||
def msg(self): # pragma: no cover
|
||||
return self.args[0]
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class TwythonAuthError(TwythonError):
|
|||
pass
|
||||
|
||||
|
||||
class TwythonRateLimitError(TwythonError):
|
||||
class TwythonRateLimitError(TwythonError): # pragma: no cover
|
||||
"""Raised when you've hit a rate limit.
|
||||
|
||||
The amount of seconds to retry your request in will be appended
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ def _transparent_params(_params):
|
|||
files = {}
|
||||
for k, v in _params.items():
|
||||
if hasattr(v, 'read') and callable(v.read):
|
||||
files[k] = v
|
||||
files[k] = v # pragma: no cover
|
||||
elif isinstance(v, bool):
|
||||
if v:
|
||||
params[k] = 'true'
|
||||
|
|
@ -27,5 +27,5 @@ def _transparent_params(_params):
|
|||
elif isinstance(v, list):
|
||||
params[k] = ','.join(v)
|
||||
else:
|
||||
continue
|
||||
continue # pragma: no cover
|
||||
return params, files
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class TwythonStreamer(object):
|
|||
|
||||
response.close()
|
||||
|
||||
def on_success(self, data):
|
||||
def on_success(self, data): # pragma: no cover
|
||||
"""Called when data has been successfull received from the stream
|
||||
|
||||
Feel free to override this to handle your streaming data how you
|
||||
|
|
@ -132,7 +132,7 @@ class TwythonStreamer(object):
|
|||
elif 'disconnect' in data:
|
||||
self.on_disconnect(data.get('disconnect'))
|
||||
|
||||
def on_error(self, status_code, data):
|
||||
def on_error(self, status_code, data): # pragma: no cover
|
||||
"""Called when stream returns non-200 status code
|
||||
|
||||
Feel free to override this to handle your streaming data how you
|
||||
|
|
@ -146,7 +146,7 @@ class TwythonStreamer(object):
|
|||
"""
|
||||
return
|
||||
|
||||
def on_delete(self, data):
|
||||
def on_delete(self, data): # pragma: no cover
|
||||
"""Called when a deletion notice is received
|
||||
|
||||
Feel free to override this to handle your streaming data how you
|
||||
|
|
@ -159,7 +159,7 @@ class TwythonStreamer(object):
|
|||
"""
|
||||
return
|
||||
|
||||
def on_limit(self, data):
|
||||
def on_limit(self, data): # pragma: no cover
|
||||
"""Called when a limit notice is received
|
||||
|
||||
Feel free to override this to handle your streaming data how you
|
||||
|
|
@ -172,7 +172,7 @@ class TwythonStreamer(object):
|
|||
"""
|
||||
return
|
||||
|
||||
def on_disconnect(self, data):
|
||||
def on_disconnect(self, data): # pragma: no cover
|
||||
"""Called when a disconnect notice is received
|
||||
|
||||
Feel free to override this to handle your streaming data how you
|
||||
|
|
@ -185,7 +185,7 @@ class TwythonStreamer(object):
|
|||
"""
|
||||
return
|
||||
|
||||
def on_timeout(self):
|
||||
def on_timeout(self): # pragma: no cover
|
||||
""" Called when the request has timed out """
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue