Example #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)
Example #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'))
Example #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))