Changed /r/me to "My Submissions" in page header, added test.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
2790
tests/cassettes/test_subreddit_draw_header.yaml
Normal file
2790
tests/cassettes/test_subreddit_draw_header.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -176,4 +176,33 @@ def test_subreddit_open_subscriptions(subreddit_page, refresh_token):
|
|||||||
# Open a subscription
|
# Open a subscription
|
||||||
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)
|
||||||
Reference in New Issue
Block a user