当前位置: 首页>>代码示例>>Python>>正文


Python exceptions.NotFound方法代码示例

本文整理汇总了Python中neutron_lib.exceptions.NotFound方法的典型用法代码示例。如果您正苦于以下问题:Python exceptions.NotFound方法的具体用法?Python exceptions.NotFound怎么用?Python exceptions.NotFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neutron_lib.exceptions的用法示例。


在下文中一共展示了exceptions.NotFound方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _test_recovery_creates_operation

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def _test_recovery_creates_operation(
            self, operation, resource, odl_resource, expected_operation,
            recovery_mock):
        if resource is not None:
            recovery_mock.return_value = resource
        else:
            recovery_mock.side_effect = nexc.NotFound
        original_row = self._test_recovery(
            operation, odl_resource, odl_const.COMPLETED)

        pending_row = db.get_all_db_rows_by_state(
            self.db_context, odl_const.PENDING)[0]
        self.assertEqual(expected_operation, pending_row['operation'])
        self.assertEqual(original_row['object_type'],
                         pending_row['object_type'])
        self.assertEqual(original_row['object_uuid'],
                         pending_row['object_uuid']) 
开发者ID:openstack,项目名称:networking-odl,代码行数:19,代码来源:test_recovery.py

示例2: _sync_resource_to_odl

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def _sync_resource_to_odl(context, row, operation_type, exists_on_odl):
    resource = None
    try:
        resource = _get_latest_resource(context, row)
    except nexc.NotFound:
        if exists_on_odl:
            journal.record(context, row.object_type,
                           row.object_uuid, odl_const.ODL_DELETE, [])
    else:
        journal.record(context, row.object_type, row.object_uuid,
                       operation_type, resource)

    journal.entry_complete(context, row) 
开发者ID:openstack,项目名称:networking-odl,代码行数:15,代码来源:recovery.py

示例3: test__get_latest_resource_none

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test__get_latest_resource_none(self, plugin_mock):
        plugin_mock.return_value.get_network.side_effect = nexc.NotFound()
        l2 = mech_driver_v2.OpenDaylightMechanismDriver.RESOURCES
        full_sync.ALL_RESOURCES[plugin_constants.CORE] = l2

        mock_row = self._mock_row(odl_const.ODL_NETWORK)
        self.assertRaises(
            nexc.NotFound, recovery._get_latest_resource,
            self.db_context.session, mock_row) 
开发者ID:openstack,项目名称:networking-odl,代码行数:11,代码来源:test_recovery.py

示例4: test_recovery_created_resource_missing_and_not_in_odl

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_recovery_created_resource_missing_and_not_in_odl(self, rmock):
        rmock.side_effect = nexc.NotFound
        self._test_recovery(odl_const.ODL_CREATE, None, odl_const.COMPLETED) 
开发者ID:openstack,项目名称:networking-odl,代码行数:5,代码来源:test_recovery.py

示例5: test_recovery_created_resource_missing_and_not_in_odl_purged

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_recovery_created_resource_missing_and_not_in_odl_purged(
            self, rmock):
        rmock.side_effect = nexc.NotFound
        self._disable_retention()
        self._test_recovery(odl_const.ODL_CREATE, None, None) 
开发者ID:openstack,项目名称:networking-odl,代码行数:7,代码来源:test_recovery.py

示例6: test_recovery_updated_resource_missing_and_not_in_odl_purged

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_recovery_updated_resource_missing_and_not_in_odl_purged(
            self, rmock):
        rmock.side_effect = nexc.NotFound
        self._disable_retention()
        self._test_recovery(odl_const.ODL_UPDATE, None, None) 
开发者ID:openstack,项目名称:networking-odl,代码行数:7,代码来源:test_recovery.py

示例7: test_not_found

# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_not_found(self):
        self._check_nexc(
            ne.NotFound,
            _('An unknown exception occurred.')) 
开发者ID:openstack,项目名称:neutron-lib,代码行数:6,代码来源:test_exceptions.py


注:本文中的neutron_lib.exceptions.NotFound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。