Updated loader tests.
This commit is contained in:
@@ -179,7 +179,7 @@ class LoadScreen(object):
|
|||||||
handled_exceptions = (RTVError, PRAWException, RequestException)
|
handled_exceptions = (RTVError, PRAWException, RequestException)
|
||||||
if isinstance(e, handled_exceptions):
|
if isinstance(e, handled_exceptions):
|
||||||
# Pass the message straight through to the user
|
# Pass the message straight through to the user
|
||||||
message = six.text_type(e).split('/n') if e else exc_name
|
message = six.text_type(e).split('/n') if str(e) else exc_name
|
||||||
self._terminal.show_notification(message)
|
self._terminal.show_notification(message)
|
||||||
return True
|
return True
|
||||||
elif isinstance(e, KeyboardInterrupt):
|
elif isinstance(e, KeyboardInterrupt):
|
||||||
|
|||||||
@@ -77,8 +77,7 @@ def test_oauth_authorize_with_refresh_token(oauth, stdscr, refresh_token):
|
|||||||
exception = OAuthException('', '')
|
exception = OAuthException('', '')
|
||||||
oauth.reddit.refresh_access_information.side_effect = exception
|
oauth.reddit.refresh_access_information.side_effect = exception
|
||||||
oauth.authorize()
|
oauth.authorize()
|
||||||
message = 'Invalid OAuth data'.encode('utf-8')
|
assert isinstance(oauth.term.loader.exception, OAuthException)
|
||||||
stdscr.derwin().addstr.assert_called_with(1, 1, message)
|
|
||||||
assert oauth.http_server is None
|
assert oauth.http_server is None
|
||||||
|
|
||||||
|
|
||||||
@@ -149,8 +148,7 @@ def test_oauth_authorize(oauth, reddit, stdscr, refresh_token):
|
|||||||
exception = OAuthException('', '')
|
exception = OAuthException('', '')
|
||||||
oauth.reddit.get_access_information.side_effect = exception
|
oauth.reddit.get_access_information.side_effect = exception
|
||||||
oauth.authorize()
|
oauth.authorize()
|
||||||
message = 'Invalid OAuth data'.encode('utf-8')
|
assert isinstance(oauth.term.loader.exception, OAuthException)
|
||||||
stdscr.derwin().addstr.assert_called_with(1, 1, message)
|
|
||||||
assert not oauth.config.save_refresh_token.called
|
assert not oauth.config.save_refresh_token.called
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user