Fix importing old path for exceptions

The network_ip_availability plugin uses old path for exceptions.
This patch fixes the path and adds negative test for the exception.

Change-Id: I9021f76e21b386f371ff73b926553611ab87fb66
Closes-bug: #1657137
This commit is contained in:
Hirofumi Ichihara 2017-01-18 14:57:03 +09:00
parent 1eacc406a3
commit 66c7c604fe
3 changed files with 32 additions and 1 deletions

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import neutron.common.exceptions as exceptions
from neutron_lib import exceptions
import neutron.db.db_base_plugin_v2 as db_base_plugin_v2
import neutron.db.network_ip_availability_db as ip_availability_db

View File

@ -0,0 +1,29 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_utils import uuidutils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.tempest.api import test_network_ip_availability as net_ip
class NetworksIpAvailabilityNegativeTest(net_ip.NetworksIpAvailabilityTest):
@test.attr(type='negative')
@test.idempotent_id('3b8693eb-6c57-4ea1-ab84-3730c9ee9c84')
def test_network_availability_nonexistent_network_id(self):
self.assertRaises(lib_exc.NotFound,
self.admin_client.show_network_ip_availability,
uuidutils.generate_uuid())

View File

@ -87,6 +87,7 @@ class NetworkClientJSON(service_client.RestClient):
'quotas': 'quotas',
'qos_policy': 'policies',
'rbac_policy': 'rbac_policies',
'network_ip_availability': 'network_ip_availabilities',
}
return resource_plural_map.get(resource_name, resource_name + 's')