Added welcome message when logging in for the first time with autologin disabled

This commit is contained in:
Michael Lazar
2018-10-01 01:45:33 -04:00
parent 7a1f2ea2eb
commit 19f246adac
5 changed files with 156 additions and 15 deletions

View File

@@ -89,7 +89,7 @@ def test_oauth_authorize_invalid_token(oauth):
def test_oauth_authorize_with_refresh_token(oauth, refresh_token):
oauth.config.refresh_token = refresh_token
oauth.authorize()
oauth.authorize(autologin=True)
assert oauth.server is None
# We should be able to handle an oauth failure
@@ -103,6 +103,18 @@ def test_oauth_authorize_with_refresh_token(oauth, refresh_token):
assert oauth.config.refresh_token is None
def test_oauth_authorize_without_autologin(oauth, terminal, refresh_token):
# The welcome message should be displayed when autologin is set to
# false, even if we're using an existing refresh token and not performing
# the whole login procedure.
oauth.config.refresh_token = refresh_token
oauth.authorize(autologin=False)
text = 'Welcome civilization_phaze_3!'.encode('utf-8')
terminal.stdscr.subwin.addstr.assert_any_call(1, 1, text)
def test_oauth_clear_data(oauth):
oauth.config.refresh_token = 'secrettoken'
oauth.reddit.refresh_token = 'secrettoken'