def test_unix_reboot(self, patch1): uobject = MagicMock(spec=UnixHost) uobject.su = MagicMock() uobject.shell = MagicMock(return_value=-1) uobject.is_alive = MagicMock(return_value=False) uobject.host = 'dummy' uobject.reconnect = MagicMock() self.assertTrue(UnixHost.reboot(uobject))
def test_unix_reboot_exception4(self, patch1, patch2): uobject = MagicMock(spec=UnixHost) uobject.su = MagicMock() uobject.execute = MagicMock(return_value=1) uobject.host = 'dummy' uobject.connect_mode = 'ssh' uobject.handle = MagicMock() uobject.reconnect = MagicMock() self.assertRaises(Exception, lambda: UnixHost.reboot(uobject))