Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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'))
Ejemplo n.º 3
0
 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))