Skip to content

Commit

Permalink
tests/commands/globals: Add tests for stdin handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Aug 24, 2017
1 parent c5d9def commit 5f96f0d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/commands/global_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

from alot.commands import globals as g_commands

from .. import utilities


class Stop(Exception):
"""exception for stopping testing of giant unmanagable functions."""
Expand Down Expand Up @@ -134,6 +136,19 @@ def test_no_spawn_stdin_success(self):
cmd.apply(ui)
ui.notify.assert_not_called()

@utilities.expected_failure
def test_no_spawn_no_stdin_attached(self):
ui = mock.Mock()
cmd = g_commands.ExternalCommand(u'test -t 0', refocus=False)
cmd.apply(ui)
ui.notify.assert_not_called()

def test_no_spawn_stdin_attached(self):
ui = mock.Mock()
cmd = g_commands.ExternalCommand(u"test -t 0", stdin=u'0', refocus=False)
cmd.apply(ui)
ui.notify.assert_called_once_with('', priority='error')

def test_no_spawn_failure(self):
ui = mock.Mock()
cmd = g_commands.ExternalCommand(u'false', refocus=False)
Expand Down

0 comments on commit 5f96f0d

Please sign in to comment.