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
diff --git a/neutron/tests/tempest/api/test_network_ip_availability_negative.py b/neutron/tests/tempest/api/test_network_ip_availability_negative.py
new file mode 100644
index 0000000..094f393
--- /dev/null
+++ b/neutron/tests/tempest/api/test_network_ip_availability_negative.py
@@ -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())
diff --git a/neutron/tests/tempest/services/network/json/network_client.py b/neutron/tests/tempest/services/network/json/network_client.py
index 610b049..671c040 100644
--- a/neutron/tests/tempest/services/network/json/network_client.py
+++ b/neutron/tests/tempest/services/network/json/network_client.py
@@ -87,6 +87,7 @@
'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')