Fixed tests.
This commit is contained in:
@@ -51,6 +51,11 @@ def test_submission_page_construct(reddit, terminal, config, oauth):
|
||||
'[5]controversial').encode('utf-8')
|
||||
window.addstr.assert_any_call(0, 0, menu)
|
||||
|
||||
# Footer
|
||||
text = ('[?]Help [q]Quit [h]Return [space]Fold/Expand [o]Open [c]Comment '
|
||||
'[a/z]Vote'.encode('utf-8'))
|
||||
window.addstr.assert_any_call(0, 0, text)
|
||||
|
||||
# Submission
|
||||
submission_data = page.content.get(-1)
|
||||
text = submission_data['title'].encode('utf-8')
|
||||
@@ -181,7 +186,7 @@ def test_submission_comment_not_enough_space(submission_page, terminal):
|
||||
|
||||
text = '(Not enough space to display)'.encode('ascii')
|
||||
window = terminal.stdscr.subwin
|
||||
window.subwin.addstr.assert_any_call(7, 1, text)
|
||||
window.subwin.addstr.assert_any_call(6, 1, text)
|
||||
|
||||
|
||||
def test_submission_vote(submission_page, refresh_token):
|
||||
|
||||
@@ -236,8 +236,7 @@ def test_prompt_input(terminal, stdscr, use_ascii):
|
||||
window.getch.side_effect = [ord('h'), ord('i'), terminal.RETURN]
|
||||
assert isinstance(terminal.prompt_input('hi'), six.text_type)
|
||||
|
||||
attr = Color.CYAN | curses.A_BOLD
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, 'hi'.encode('ascii'), attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, 'hi'.encode('ascii'))
|
||||
assert window.nlines == 1
|
||||
assert window.ncols == 78
|
||||
|
||||
@@ -254,27 +253,26 @@ def test_prompt_input(terminal, stdscr, use_ascii):
|
||||
def test_prompt_y_or_n(terminal, stdscr):
|
||||
|
||||
stdscr.getch.side_effect = [ord('y'), ord('N'), terminal.ESCAPE, ord('a')]
|
||||
attr = Color.CYAN | curses.A_BOLD
|
||||
text = 'hi'.encode('ascii')
|
||||
|
||||
# Press 'y'
|
||||
assert terminal.prompt_y_or_n('hi')
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text)
|
||||
assert not curses.flash.called
|
||||
|
||||
# Press 'N'
|
||||
assert not terminal.prompt_y_or_n('hi')
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text)
|
||||
assert not curses.flash.called
|
||||
|
||||
# Press Esc
|
||||
assert not terminal.prompt_y_or_n('hi')
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text)
|
||||
assert not curses.flash.called
|
||||
|
||||
# Press an invalid key
|
||||
assert not terminal.prompt_y_or_n('hi')
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text)
|
||||
assert curses.flash.called
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user