當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。