Ejemplo n.º 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())
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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()
Ejemplo n.º 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')
Ejemplo n.º 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()
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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()
Ejemplo n.º 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())
Ejemplo n.º 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')
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()