summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-08-23 17:16:05 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-08-23 17:35:46 -0700
commitc5d9def60e102b30cb72e8f32149c67c3765563c (patch)
treec76c800b36aec5ba6d310c5d92181cf6ecd544af /tests
parent63372f52755aa0ed4e085ea1d72bd08345b2cf36 (diff)
tests/commands/global: Fix tests
These tests were wrong they would always pass, even if the code underneath was broken. With this fix they actually work.
Diffstat (limited to 'tests')
-rw-r--r--tests/commands/global_test.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/tests/commands/global_test.py b/tests/commands/global_test.py
index edb903dd..c6b466c5 100644
--- a/tests/commands/global_test.py
+++ b/tests/commands/global_test.py
@@ -121,31 +121,22 @@ class TestComposeCommand(unittest.TestCase):
class TestExternalCommand(unittest.TestCase):
- class Success(Exception):
- pass
-
- def on_success(self):
- raise self.Success
-
def test_no_spawn_no_stdin_success(self):
- cmd = g_commands.ExternalCommand(
- u'true',
- refocus=False, on_success=self.on_success)
- with self.assertRaises(self.Success):
- cmd.apply(mock.Mock())
+ ui = mock.Mock()
+ cmd = g_commands.ExternalCommand(u'true', refocus=False)
+ cmd.apply(ui)
+ ui.notify.assert_not_called()
def test_no_spawn_stdin_success(self):
- cmd = g_commands.ExternalCommand(
- u"awk '{ exit $0 }'",
- stdin=u'0', refocus=False, on_success=self.on_success)
- with self.assertRaises(self.Success):
- cmd.apply(mock.Mock())
+ ui = mock.Mock()
+ cmd = g_commands.ExternalCommand(u"awk '{ exit $0 }'", stdin=u'0',
+ refocus=False)
+ cmd.apply(ui)
+ ui.notify.assert_not_called()
def test_no_spawn_failure(self):
ui = mock.Mock()
- cmd = g_commands.ExternalCommand(
- u'false',
- refocus=False, on_success=self.on_success)
+ cmd = g_commands.ExternalCommand(u'false', refocus=False)
cmd.apply(ui)
ui.notify.assert_called_once_with('', priority='error')