def test_unix_execute(self): uobject = MagicMock(spec=UnixHost) uobject.handle = MagicMock() uobject.prompt = MagicMock(return_value='%') uobject.handle.execute = MagicMock(return_value='regress') uobject.shell_timeout = 60 self.assertEqual(UnixHost.execute(uobject, command='ls'), 'regress')
def test_unix_execute_exception(self): uobject = MagicMock(spec=UnixHost) uobject.handle = MagicMock() uobject.prompt = MagicMock(return_value='%') self.assertRaises(Exception, lambda: UnixHost.execute(uobject))