Exemple #1
0
 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())
Exemple #2
0
 def test_no_spawn_failure(self):
     ui = mock.Mock()
     cmd = g_commands.ExternalCommand(u'false',
                                      refocus=False,
                                      on_success=self.on_success)
     cmd.apply(ui)
     ui.notify.assert_called_once_with('', priority='error')
Exemple #3
0
 async def test_no_spawn_stdin_attached(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand(u"test -t 0",
                                      stdin=u'0',
                                      refocus=False)
     await cmd.apply(ui)
     ui.notify.assert_called_once_with('', priority='error')
Exemple #4
0
 async def test_no_spawn_stdin_success(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand(u"awk '{ exit $0 }'",
                                      stdin=u'0',
                                      refocus=False)
     await cmd.apply(ui)
     ui.notify.assert_not_called()
Exemple #5
0
 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')
Exemple #6
0
 def test_no_spawn_stdin_success(self):
     ui = mock.Mock()
     cmd = g_commands.ExternalCommand(u"awk '{ exit $0 }'",
                                      stdin=u'0',
                                      refocus=False)
     cmd.apply(ui)
     ui.notify.assert_not_called()
Exemple #7
0
 async def test_spawn_failure(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand('false', refocus=False, spawn=True)
     await cmd.apply(ui)
     ui.notify.assert_called_once_with(
         'editor has exited with error code 1 -- No stderr output',
         priority='error')
Exemple #8
0
 async def test_no_spawn_stdin_attached(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand("test -t 0", stdin='0', refocus=False)
     await cmd.apply(ui)
     ui.notify.assert_called_once_with(
         'editor has exited with error code 1 -- No stderr output',
         priority='error')
Exemple #9
0
 def test_spawn_no_stdin_success(self):
     ui = mock.Mock()
     cmd = g_commands.ExternalCommand(u'true', refocus=False, spawn=True)
     cmd.apply(ui)
     ui.notify.assert_not_called()
Exemple #10
0
 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())
Exemple #11
0
 async def test_spawn_failure(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand(u'false', refocus=False, spawn=True)
     await cmd.apply(ui)
     ui.notify.assert_called_once_with('', priority='error')
Exemple #12
0
 async def test_spawn_no_stdin_success(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand(u'true', refocus=False, spawn=True)
     await cmd.apply(ui)
     ui.notify.assert_not_called()
Exemple #13
0
 async def test_no_spawn_no_stdin_attached(self):
     ui = utilities.make_ui()
     cmd = g_commands.ExternalCommand(u'test -t 0', refocus=False)
     await cmd.apply(ui)
     ui.notify.assert_not_called()
Exemple #14
0
 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()