Large commit to add support for browsing the inbox

This commit is contained in:
Michael Lazar
2019-02-27 02:04:45 -05:00
parent 3f7c9410a6
commit 7a71023a40
34 changed files with 23150 additions and 363 deletions

View File

@@ -19,6 +19,7 @@ from rtv.terminal import Terminal
from rtv.subreddit_page import SubredditPage
from rtv.submission_page import SubmissionPage
from rtv.subscription_page import SubscriptionPage
from rtv.inbox_page import InboxPage
try:
from unittest import mock
@@ -124,7 +125,9 @@ def refresh_token(request):
if request.config.option.record_mode == 'none':
return 'mock_refresh_token'
else:
return open(request.config.option.refresh_token).read()
token_file = request.config.option.refresh_token
with open(os.path.expanduser(token_file)) as fp:
return fp.read()
@pytest.yield_fixture()
@@ -258,3 +261,16 @@ def subscription_page(reddit, terminal, config, oauth):
assert terminal.loader.exception is None
page.draw()
return page
@pytest.fixture()
def inbox_page(reddit, terminal, config, oauth, refresh_token):
# The inbox page required logging in on an account with at least one message
config.refresh_token = refresh_token
oauth.authorize()
with terminal.loader():
page = InboxPage(reddit, terminal, config, oauth)
assert terminal.loader.exception is None
page.draw()
return page