Added tests for subreddit.py's new show_frontpage. Refactored getters and setters.

This commit is contained in:
mardiqwop
2016-07-20 16:02:34 -04:00
parent 270f0dff3c
commit 1dbcf22742
4 changed files with 17 additions and 17 deletions

View File

@@ -225,4 +225,12 @@ def test_subreddit_draw_header(subreddit_page, refresh_token, terminal):
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)
terminal.stdscr.subwin.addstr.assert_any_call(0, 0, text)
def test_subreddit_frontpage_toggle(subreddit_page, terminal):
with mock.patch.object(terminal, 'prompt_input'):
terminal.prompt_input.return_value = 'aww'
subreddit_page.controller.trigger('/')
assert subreddit_page.content.name == '/r/aww'
subreddit_page.controller.trigger('p')
assert subreddit_page.content.name == '/r/front'