Changed /r/me to "My Submissions" in page header, added test.

This commit is contained in:
Michael Lazar
2016-07-07 17:44:35 -07:00
parent dacbe11e4b
commit 42d342f175
3 changed files with 2823 additions and 2 deletions

View File

@@ -280,7 +280,9 @@ class Page(object):
ch, attr = str(' '), curses.A_REVERSE | curses.A_BOLD | Color.CYAN ch, attr = str(' '), curses.A_REVERSE | curses.A_BOLD | Color.CYAN
window.bkgd(ch, attr) window.bkgd(ch, attr)
sub_name = self.content.name.replace('/r/front', 'Front Page') sub_name = self.content.name
sub_name = sub_name.replace('/r/front', 'Front Page')
sub_name = sub_name.replace('/r/me', 'My Submissions')
self.term.add_line(window, sub_name, 0, 0) self.term.add_line(window, sub_name, 0, 0)
# Set the terminal title # Set the terminal title

File diff suppressed because it is too large Load Diff

View File

@@ -177,3 +177,32 @@ def test_subreddit_open_subscriptions(subreddit_page, refresh_token):
with mock.patch('rtv.page.Page.loop') as loop: with mock.patch('rtv.page.Page.loop') as loop:
subreddit_page.controller.trigger('s') subreddit_page.controller.trigger('s')
assert loop.called assert loop.called
def test_subreddit_draw_header(subreddit_page, refresh_token, terminal):
# /r/front alias should be renamed in the header
subreddit_page.refresh_content(name='/r/front')
subreddit_page.draw()
text = 'Front Page'.encode('utf-8')
terminal.stdscr.subwin.addstr.assert_any_call(0, 0, text)
subreddit_page.refresh_content(name='/r/front/new')
subreddit_page.draw()
text = 'Front Page'.encode('utf-8')
terminal.stdscr.subwin.addstr.assert_any_call(0, 0, text)
# Log in to check the user submissions page
subreddit_page.config.refresh_token = refresh_token
subreddit_page.oauth.authorize()
# /r/me alias should be renamed in the header
subreddit_page.refresh_content(name='/r/me')
subreddit_page.draw()
text = 'My Submissions'.encode('utf-8')
terminal.stdscr.subwin.addstr.assert_any_call(0, 0, text)
subreddit_page.refresh_content(name='/r/me/new')
subreddit_page.draw()
text = 'My Submissions'.encode('utf-8')
terminal.stdscr.subwin.addstr.assert_any_call(0, 0, text)