Merge remote-tracking branch 'upstream/master'

Refactoring
This commit is contained in:
David Foucher
2016-07-24 01:27:11 +02:00
76 changed files with 62359 additions and 13645 deletions

View File

@@ -216,13 +216,34 @@ def test_subreddit_draw_header(subreddit_page, refresh_token, terminal):
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')
# /u/me alias should be renamed in the header
subreddit_page.refresh_content(name='/u/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.refresh_content(name='/u/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)
# /u/saved alias should be renamed in the header
subreddit_page.refresh_content(name='/u/saved')
subreddit_page.draw()
text = 'My Saved Submissions'.encode('utf-8')
terminal.stdscr.subwin.addstr.assert_any_call(0, 0, text)
subreddit_page.refresh_content(name='/u/saved/new')
subreddit_page.draw()
text = 'My Saved Submissions'.encode('utf-8')
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'