Changed order-by shortcut to trigger on a single keystroke. #330
This commit is contained in:
@@ -115,17 +115,13 @@ def test_subreddit_prompt(subreddit_page, terminal):
|
||||
|
||||
def test_subreddit_order_top(subreddit_page, terminal):
|
||||
|
||||
# Sort by top - First time selects default
|
||||
subreddit_page.controller.trigger('2')
|
||||
assert subreddit_page.content.order == 'top'
|
||||
|
||||
# Second time opens the menu
|
||||
# Sort by top
|
||||
with mock.patch.object(terminal, 'show_notification'):
|
||||
# Invalid selection
|
||||
terminal.show_notification.return_value = ord('x')
|
||||
subreddit_page.controller.trigger('2')
|
||||
terminal.show_notification.assert_called_with('Invalid option')
|
||||
assert subreddit_page.content.order == 'top'
|
||||
assert subreddit_page.content.order is None
|
||||
|
||||
# Valid selection - sort by week
|
||||
terminal.show_notification.reset_mock()
|
||||
@@ -136,22 +132,19 @@ def test_subreddit_order_top(subreddit_page, terminal):
|
||||
|
||||
def test_subreddit_order_controversial(subreddit_page, terminal):
|
||||
|
||||
# Now do controversial
|
||||
subreddit_page.controller.trigger('5')
|
||||
assert subreddit_page.content.order == 'controversial'
|
||||
|
||||
# Sort by controversial
|
||||
with mock.patch.object(terminal, 'show_notification'):
|
||||
# Invalid selection
|
||||
terminal.show_notification.return_value = ord('x')
|
||||
subreddit_page.controller.trigger('5')
|
||||
terminal.show_notification.assert_called_with('Invalid option')
|
||||
assert subreddit_page.content.order == 'controversial'
|
||||
assert subreddit_page.content.order is None
|
||||
|
||||
# Valid selection - sort by week
|
||||
# Valid selection - sort by default
|
||||
terminal.show_notification.reset_mock()
|
||||
terminal.show_notification.return_value = ord('3')
|
||||
terminal.show_notification.return_value = ord('\n')
|
||||
subreddit_page.controller.trigger('5')
|
||||
assert subreddit_page.content.order == 'controversial-week'
|
||||
assert subreddit_page.content.order == 'controversial'
|
||||
|
||||
|
||||
def test_subreddit_open(subreddit_page, terminal, config):
|
||||
|
||||
Reference in New Issue
Block a user