def test_unix_shell(self): uobject = MagicMock(spec=UnixHost) uobject.handle = MagicMock() uobject.execute = MagicMock(return_value=1) uobject.response = 'regress' uobject.shell_timeout = 60 self.assertIsInstance(UnixHost.shell(uobject, command='ls'), Response)
def test_unix_shell_exception_no_match(self): uobject = MagicMock(spec=UnixHost) uobject.handle = MagicMock() uobject.execute = MagicMock(return_value=-1) self.assertRaises(Exception, lambda: UnixHost.shell(uobject, command='ls'))
def test_unix_shell_exception_no_cmd(self): uobject = MagicMock(spec=UnixHost) uobject.handle = MagicMock() uobject.execute = MagicMock(return_value=1) uobject.response = 'regress' self.assertRaises(Exception, lambda: UnixHost.shell(uobject))