Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(25)  |  Call(25)  |  Derive(0)  |  Import(0)

src/o/s/oslo.vmware-0.3/tests/test_api.py   oslo.vmware(Download)
        retry = api.RetryDecorator(2, 0, 0,
                                   (exceptions.VimSessionOverLoadException,))
        self.assertRaises(exceptions.VimSessionOverLoadException, retry(func))
        self.assertTrue(retry._retry_count == 2)
 
 
        retry = api.RetryDecorator()
        self.assertRaises(exceptions.VimException, retry(func))
        self.assertTrue(retry._retry_count == 0)
 
        module = mock.Mock()
        module.api = api
        self.assertRaises(exceptions.VimFaultException,
                          lambda: api_session.invoke_api(module, 'api'))
 
        task = mock.Mock()
        with mock.patch.object(greenthread, 'sleep'):
            self.assertRaises(exceptions.VMwareDriverException,
                              lambda: api_session.wait_for_task(task))
        api_session.invoke_api.assert_called_with(vim_util,
        task = mock.Mock()
        with mock.patch.object(greenthread, 'sleep'):
            self.assertRaises(exceptions.VimException,
                              lambda: api_session.wait_for_task(task))
        api_session.invoke_api.assert_called_once_with(vim_util,

src/o/s/oslo.vmware-0.3/tests/test_vim.py   oslo.vmware(Download)
        service_mock = vim_obj._client.service
        setattr(service_mock, attr_name, side_effect)
        self.assertRaises(exceptions.VimFaultException,
                          lambda: vim_obj.retrievePropertiesEx(managed_object))
 
        service_mock = mock.Mock(spec=vim.Vim)
        vim_obj._client.service = service_mock
        self.assertRaises(exceptions.VimAttributeException,
                          lambda: vim_obj.powerOn(managed_object))
 
        service_mock = vim_obj._client.service
        setattr(service_mock, attr_name, side_effect)
        self.assertRaises(exceptions.VimSessionOverLoadException,
                          lambda: vim_obj.powerOn(managed_object))
 
        service_mock = vim_obj._client.service
        setattr(service_mock, attr_name, side_effect)
        self.assertRaises(exceptions.VimSessionOverLoadException,
                          lambda: vim_obj.powerOn(managed_object))
 
        service_mock = vim_obj._client.service
        setattr(service_mock, attr_name, side_effect)
        self.assertRaises(exceptions.VimSessionOverLoadException,
                          lambda: vim_obj.powerOn(managed_object))
 

src/o/s/oslo.vmware-0.3/tests/test_image_transfer.py   oslo.vmware(Download)
        self.image_service.show.side_effect = image_service_show_side_effect
        writer.start()
        self.assertRaises(exceptions.ImageTransferException,
                          writer.wait)
        self.image_service.update.assert_called_once_with(self.context,
        self.image_service.show.side_effect = image_service_show_side_effect
        writer.start()
        self.assertRaises(exceptions.ImageTransferException,
                          writer.wait)
        self.image_service.update.assert_called_once_with(self.context,
    def test_start_with_image_service_show_exception(self):
        writer = self._create_image_writer()
        self.image_service.show.side_effect = RuntimeError()
        writer.start()
        self.assertRaises(exceptions.ImageTransferException, writer.wait)
        rw_task = image_transfer.FileReadWriteTask(input_file, output_file)
        rw_task.start()
        self.assertRaises(exceptions.ImageTransferException, rw_task.wait)
        input_file.read.assert_called_once_with(rw_handles.READ_CHUNKSIZE)
 

src/o/s/oslo.vmware-0.3/tests/test_rw_handles.py   oslo.vmware(Download)
    def test_init_failure(self):
        session = self._create_mock_session(False)
        self.assertRaises(exceptions.VimException,
                          lambda: rw_handles.VmdkWriteHandle(session,
                                                             '10.1.2.3',
                                            100)
        session.invoke_api.side_effect = exceptions.VimException(None)
        self.assertRaises(exceptions.VimException, handle.update_progress)
 
    def test_close(self):
    def test_init_failure(self):
        session = self._create_mock_session(False)
        self.assertRaises(exceptions.VimException,
                          lambda: rw_handles.VmdkReadHandle(session,
                                                            '10.1.2.3',
                                           100)
        session.invoke_api.side_effect = exceptions.VimException(None)
        self.assertRaises(exceptions.VimException, handle.update_progress)
 
    def test_close(self):