Merge "Change tempest BadRequest exc to tempest-lib exc"
diff --git a/tempest/api/baremetal/admin/test_ports_negative.py b/tempest/api/baremetal/admin/test_ports_negative.py
index dd19edc..8dbdedf 100644
--- a/tempest/api/baremetal/admin/test_ports_negative.py
+++ b/tempest/api/baremetal/admin/test_ports_negative.py
@@ -14,7 +14,6 @@
from tempest.api.baremetal.admin import base
from tempest.common.utils import data_utils
-from tempest import exceptions as exc
from tempest import test
@@ -32,19 +31,19 @@
node_id = self.node['uuid']
address = 'malformed:mac'
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_port, node_id=node_id, address=address)
@test.attr(type=['negative', 'smoke'])
def test_create_port_nonexsistent_node_id(self):
node_id = str(data_utils.rand_uuid())
address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id,
- address=address)
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
+ node_id=node_id, address=address)
@test.attr(type=['negative', 'smoke'])
def test_show_port_malformed_uuid(self):
- self.assertRaises(exc.BadRequest, self.client.show_port,
+ self.assertRaises(lib_exc.BadRequest, self.client.show_port,
'malformed:uuid')
@test.attr(type=['negative', 'smoke'])
@@ -54,7 +53,7 @@
@test.attr(type=['negative', 'smoke'])
def test_show_port_by_mac_not_allowed(self):
- self.assertRaises(exc.BadRequest, self.client.show_port,
+ self.assertRaises(lib_exc.BadRequest, self.client.show_port,
data_utils.rand_mac_address())
@test.attr(type=['negative', 'smoke'])
@@ -71,15 +70,15 @@
def test_create_port_no_mandatory_field_node_id(self):
address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.create_port, node_id=None,
+ self.assertRaises(lib_exc.BadRequest, self.create_port, node_id=None,
address=address)
@test.attr(type=['negative', 'smoke'])
def test_create_port_no_mandatory_field_mac(self):
node_id = self.node['uuid']
- self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id,
- address=None)
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
+ node_id=node_id, address=None)
@test.attr(type=['negative', 'smoke'])
def test_create_port_malformed_port_uuid(self):
@@ -87,13 +86,13 @@
address = data_utils.rand_mac_address()
uuid = 'malformed:uuid'
- self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id,
- address=address, uuid=uuid)
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
+ node_id=node_id, address=address, uuid=uuid)
@test.attr(type=['negative', 'smoke'])
def test_create_port_malformed_node_id(self):
address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.create_port,
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
node_id='malformed:nodeid', address=address)
@test.attr(type=['negative', 'smoke'])
@@ -117,7 +116,7 @@
'op': 'replace',
'value': 'new-value'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, address,
patch)
@@ -147,7 +146,7 @@
self.create_port(node_id=node_id, address=address)
new_address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.client.update_port,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port,
uuid='malformed:uuid',
patch=[{'path': '/address', 'op': 'replace',
'value': new_address}])
@@ -160,7 +159,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/nonexistent', ' op': 'add',
'value': 'value'}])
@@ -175,7 +174,7 @@
patch = [{'path': '/node_uuid',
'op': 'replace',
'value': 'malformed:node_uuid'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -206,7 +205,7 @@
patch = [{'path': '/node_uuid',
'op': 'replace',
'value': data_utils.rand_uuid()}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -221,7 +220,7 @@
'op': 'replace',
'value': 'malformed:mac'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -234,7 +233,7 @@
patch = [{'path': '/nonexistent', ' op': 'replace', 'value': 'value'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -245,7 +244,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/address', 'op': 'remove'}])
@test.attr(type=['negative', 'smoke'])
@@ -256,7 +255,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/uuid', 'op': 'remove'}])
@test.attr(type=['negative', 'smoke'])
@@ -267,7 +266,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/nonexistent', 'op': 'remove'}])
@test.attr(type=['negative', 'smoke'])
@@ -276,7 +275,7 @@
address = data_utils.rand_mac_address()
self.create_port(node_id=node_id, address=address)
- self.assertRaises(exc.BadRequest, self.client.delete_port, address)
+ self.assertRaises(lib_exc.BadRequest, self.client.delete_port, address)
@test.attr(type=['negative', 'smoke'])
def test_update_port_mixed_ops_integrity(self):
@@ -306,7 +305,7 @@
'op': 'replace',
'value': 'value'}]
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
patch)
# patch should not be applied
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 48f6f94..fd44f7f 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -18,7 +18,6 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -52,7 +51,7 @@
@test.attr(type=['negative', 'gate'])
def test_aggregate_create_aggregate_name_length_less_than_1(self):
# the length of aggregate name should >= 1 and <=255
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_aggregate,
name='')
@@ -60,7 +59,7 @@
def test_aggregate_create_aggregate_name_length_exceeds_255(self):
# the length of aggregate name should >= 1 and <=255
aggregate_name = 'a' * 256
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_aggregate,
name=aggregate_name)
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py
index b553397..f717291 100644
--- a/tempest/api/compute/admin/test_fixed_ips_negative.py
+++ b/tempest/api/compute/admin/test_fixed_ips_negative.py
@@ -16,7 +16,6 @@
from tempest.api.compute import base
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -73,7 +72,7 @@
# NOTE(eliqiao): in Juno, the exception is NotFound, but in master, we
# change the error code to BadRequest, both exceptions should be
# accepted by tempest
- self.assertRaises((lib_exc.NotFound, exceptions.BadRequest),
+ self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
self.client.reserve_fixed_ip,
"my.invalid.ip", body)
@@ -81,6 +80,6 @@
@test.services('network')
def test_fixed_ip_with_invalid_action(self):
body = {"invalid_action": "None"}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reserve_fixed_ip,
self.ip, body)
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 360bcf7..8d5c5e3 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
import uuid
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -210,7 +210,7 @@
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is not used by other user
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.os.servers_client.create_server,
'test', self.image_ref, flavor['id'])
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
index e414973..c22602a 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
@@ -18,7 +18,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -110,7 +109,7 @@
@test.attr(type=['negative', 'gate'])
def test_flavor_update_mismatch_key(self):
# the key will be updated should be match the key in the body
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_flavor_extra_spec,
self.flavor['id'],
"key2",
@@ -119,7 +118,7 @@
@test.attr(type=['negative', 'gate'])
def test_flavor_update_more_key(self):
# there should be just one item in the request body
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_flavor_extra_spec,
self.flavor['id'],
"key1",
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index 20429b1..8d70c44 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -16,7 +16,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -72,7 +71,7 @@
# only 'status' and 'maintenance_mode' are the valid params.
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname,
status='enable',
@@ -84,7 +83,7 @@
# 'status' can only be 'enable' or 'disable'
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname,
status='invalid',
@@ -95,7 +94,7 @@
# 'maintenance_mode' can only be 'enable' or 'disable'
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname,
status='enable',
@@ -106,7 +105,7 @@
# 'status' or 'maintenance_mode' needed for host update
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname)
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
index 1e03bd0..5453ff4 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
@@ -19,7 +19,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -44,6 +43,6 @@
@test.attr(type=['negative', 'gate'])
def test_get_instance_usage_audit_logs_with_invalid_time(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.adm_client.get_instance_usage_audit_log,
"invalid_time")
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 3ef2f80..7fd87f6 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -21,7 +21,6 @@
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -100,13 +99,13 @@
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_invalid_state(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state='invalid')
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_invalid_type(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state=1)
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
index b371f2d..0d88f6c 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -17,7 +17,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -52,7 +51,7 @@
# Get usage for tenant with invalid date
params = {'start': self.end,
'end': self.start}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.adm_client.get_tenant_usage,
self.client.tenant_id, params)
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index 9697d57..08e73ca 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -20,7 +20,6 @@
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -92,6 +91,6 @@
def test_associate_ip_to_server_without_passing_floating_ip(self):
# Negative test:Association of empty floating IP to specific server
# should raise NotFound or BadRequest(In case of Nova V2.1) exception.
- self.assertRaises((lib_exc.NotFound, exceptions.BadRequest),
+ self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
self.client.associate_floating_ip_to_server,
'', self.server_id)
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index 65a91b0..7f15ad1 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -19,7 +19,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
@@ -79,7 +78,7 @@
# Return an error when creating image with invalid metadata
snapshot_name = data_utils.rand_name('test-snap-')
meta = {'': ''}
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
self.server_id, snapshot_name, meta)
@test.attr(type=['negative', 'gate'])
@@ -87,7 +86,7 @@
# Return an error when creating image with meta data over 256 chars
snapshot_name = data_utils.rand_name('test-snap-')
meta = {'a' * 260: 'b' * 260}
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
self.server_id, snapshot_name, meta)
@test.attr(type=['negative', 'gate'])
@@ -112,7 +111,7 @@
# Return an error if snapshot name over 256 characters is passed
snapshot_name = data_utils.rand_name('a' * 260)
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
self.server_id, snapshot_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/keypairs/test_keypairs_negative.py b/tempest/api/compute/keypairs/test_keypairs_negative.py
index 1586405..ea25527 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_negative.py
@@ -18,7 +18,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -38,7 +37,7 @@
# Keypair should not be created with a non RSA public key
k_name = data_utils.rand_name('keypair-')
pub_key = "ssh-rsa JUNK nova@ubuntu"
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self._create_keypair, k_name, pub_key)
@test.attr(type=['negative', 'gate'])
@@ -53,7 +52,7 @@
# Keypair should not be created with an empty public key
k_name = data_utils.rand_name("keypair-")
pub_key = ' '
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name, pub_key)
@test.attr(type=['negative', 'gate'])
@@ -61,7 +60,7 @@
# Keypair should not be created when public key bits are too long
k_name = data_utils.rand_name("keypair-")
pub_key = 'ssh-rsa ' + 'A' * 2048 + ' openstack@ubuntu'
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name, pub_key)
@test.attr(type=['negative', 'gate'])
@@ -77,19 +76,19 @@
@test.attr(type=['negative', 'gate'])
def test_create_keypair_with_empty_name_string(self):
# Keypairs with name being an empty string should not be created
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
'')
@test.attr(type=['negative', 'gate'])
def test_create_keypair_with_long_keynames(self):
# Keypairs with name longer than 255 chars should not be created
k_name = 'keypair-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name)
@test.attr(type=['negative', 'gate'])
def test_create_keypair_invalid_name(self):
# Keypairs with name being an invalid name should not be created
k_name = 'key_/.\@:'
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name)
diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
index c8da63f..dc63936 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
@@ -18,7 +18,6 @@
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -62,7 +61,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -85,7 +84,7 @@
to_port)
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
# Add the same rule to the group should fail
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -102,7 +101,7 @@
from_port = 22
to_port = 22
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -118,7 +117,7 @@
ip_protocol = 'tcp'
from_port = data_utils.rand_int_id(start=65536)
to_port = 22
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -134,7 +133,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = data_utils.rand_int_id(start=65536)
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -150,7 +149,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = 21
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
secgroup_id, ip_protocol, from_port, to_port)
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index eff91b0..0f68665 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -101,7 +102,7 @@
# Check that we are not able to delete the security
# group since it is in use by an active server
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.delete_security_group,
sg['id'])
@@ -113,7 +114,7 @@
# Check that we are not able to delete the other security
# group since it is in use by an active server
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.delete_security_group,
sg2['id'])
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index a083406..4c8de27 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -20,7 +20,6 @@
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -66,15 +65,15 @@
# as an empty string/with white spaces/chars more than 255
s_description = data_utils.rand_name('description-')
# Create Security Group with empty string as group name
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, "", s_description)
# Create Security Group with white space in group name
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, " ",
s_description)
# Create Security Group with group name longer than 255 chars
s_name = 'securitygroup-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name,
s_description)
@@ -87,14 +86,14 @@
# as an empty string/with white spaces/chars more than 255
s_name = data_utils.rand_name('securitygroup-')
# Create Security Group with empty string as description
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name, "")
# Create Security Group with white space in description
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name, " ")
# Create Security Group with group description longer than 255 chars
s_description = 'description-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name,
s_description)
@@ -109,7 +108,7 @@
s_description = data_utils.rand_name('description-')
self.create_security_group(s_name, s_description)
# Now try the Security Group with the same 'Name'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name,
s_description)
@@ -124,7 +123,7 @@
default_security_group_id = body[i]['id']
break
# Deleting the "default" Security Group
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.delete_security_group,
default_security_group_id)
@@ -154,7 +153,7 @@
s_description = data_utils.rand_name('description-')
# Create a non int sg_id
sg_id_invalid = data_utils.rand_name('sg-')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_security_group, sg_id_invalid,
name=s_name, description=s_description)
@@ -169,7 +168,7 @@
securitygroup_id = securitygroup['id']
# Update Security Group with group name longer than 255 chars
s_new_name = 'securitygroup-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_security_group,
securitygroup_id, name=s_new_name)
@@ -184,7 +183,7 @@
securitygroup_id = securitygroup['id']
# Update Security Group with group description longer than 255 chars
s_new_des = 'des-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_security_group,
securitygroup_id, description=s_new_des)
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index 3827ad9..2f12882 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -14,9 +14,9 @@
# under the License.
from six import moves
+from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -113,19 +113,19 @@
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_limits_pass_string(self):
# Return an error if a string value is passed for limit
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
+ self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
{'limit': 'testing'})
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_limits_pass_negative_value(self):
# Return an error if a negative value for limit is passed
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
+ self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
{'limit': -1})
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_changes_since_invalid_date(self):
# Return an error when invalid date format is passed
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
+ self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
{'changes-since': '2011/01/01'})
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/servers/test_multiple_create_negative.py b/tempest/api/compute/servers/test_multiple_create_negative.py
index dc83bfc..eca97c1 100644
--- a/tempest/api/compute/servers/test_multiple_create_negative.py
+++ b/tempest/api/compute/servers/test_multiple_create_negative.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -38,31 +39,31 @@
@test.attr(type=['negative', 'gate'])
def test_min_count_less_than_one(self):
invalid_min_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
min_count=invalid_min_count)
@test.attr(type=['negative', 'gate'])
def test_min_count_non_integer(self):
invalid_min_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
min_count=invalid_min_count)
@test.attr(type=['negative', 'gate'])
def test_max_count_less_than_one(self):
invalid_max_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
max_count=invalid_max_count)
@test.attr(type=['negative', 'gate'])
def test_max_count_non_integer(self):
invalid_max_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
max_count=invalid_max_count)
@test.attr(type=['negative', 'gate'])
def test_max_count_less_than_min_count(self):
min_count = 3
max_count = 2
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
min_count=min_count,
max_count=max_count)
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index 5357f80..441c965 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -17,7 +17,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -42,7 +41,7 @@
for sz in [256, 257, 511, 1023]:
key = "k" * sz
meta = {key: 'data1'}
- self.assertRaises((exceptions.BadRequest, lib_exc.OverLimit),
+ self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
meta=meta)
@@ -52,7 +51,7 @@
def test_create_server_metadata_blank_key(self):
# Blank key should trigger an error.
meta = {'': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
meta=meta)
@@ -78,7 +77,7 @@
# Raise BadRequest if key in uri does not match
# the key passed in body.
meta = {'testkey': 'testvalue'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata_item,
self.server_id, 'key', meta)
@@ -106,7 +105,7 @@
def test_update_metadata_with_blank_key(self):
# Blank key should trigger an error
meta = {'': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_server_metadata,
self.server_id, meta=meta)
@@ -148,7 +147,7 @@
# Raise a bad request error for blank key.
# set_server_metadata will replace all metadata with new value
meta = {'': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata,
self.server_id, meta=meta)
@@ -157,6 +156,6 @@
# Raise a bad request error for a missing metadata field
# set_server_metadata will replace all metadata with new value
meta = {'meta1': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata,
self.server_id, meta=meta, no_metadata_field=True)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 830c8d0..d89aff4 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -22,7 +22,6 @@
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -54,7 +53,7 @@
def test_server_name_blank(self):
# Create a server with name parameter empty
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name='')
@@ -66,7 +65,7 @@
person = [{'path': '/etc/testfile.txt',
'contents': file_contents}]
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
personality=person)
@@ -74,7 +73,7 @@
def test_create_with_invalid_image(self):
# Create a server with an unknown image
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
image_id=-1)
@@ -82,7 +81,7 @@
def test_create_with_invalid_flavor(self):
# Create a server with an unknown flavor
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
flavor=-1,)
@@ -91,7 +90,7 @@
# An access IPv4 address must match a valid address pattern
IPv4 = '1.1.1.1.1.1'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server, accessIPv4=IPv4)
@test.attr(type=['negative', 'gate'])
@@ -100,7 +99,7 @@
IPv6 = 'notvalid'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server, accessIPv6=IPv6)
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
@@ -119,7 +118,7 @@
def test_resize_server_with_non_existent_flavor(self):
# Resize a server with non-existent flavor
nonexistent_flavor = data_utils.rand_uuid()
- self.assertRaises(exceptions.BadRequest, self.client.resize,
+ self.assertRaises(lib_exc.BadRequest, self.client.resize,
self.server_id, flavor_ref=nonexistent_flavor)
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
@@ -127,7 +126,7 @@
@test.attr(type=['negative', 'gate'])
def test_resize_server_with_null_flavor(self):
# Resize a server with null flavor
- self.assertRaises(exceptions.BadRequest, self.client.resize,
+ self.assertRaises(lib_exc.BadRequest, self.client.resize,
self.server_id, flavor_ref="")
@test.attr(type=['negative', 'gate'])
@@ -174,7 +173,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_numeric_server_name(self):
server_name = 12345
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name=server_name)
@@ -183,7 +182,7 @@
# Create a server with name length exceeding 256 characters
server_name = 'a' * 256
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name=server_name)
@@ -193,7 +192,7 @@
networks = [{'fixed_ip': '10.0.1.1', 'uuid': 'a-b-c-d-e-f-g-h-i-j'}]
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
networks=networks)
@@ -202,7 +201,7 @@
# Pass a non-existent keypair while creating a server
key_name = data_utils.rand_name('key')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
key_name=key_name)
@@ -211,7 +210,7 @@
# Pass really long metadata while creating a server
metadata = {'a': 'b' * 260}
- self.assertRaises((exceptions.BadRequest, lib_exc.OverLimit),
+ self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
meta=metadata)
@@ -232,7 +231,7 @@
server_name = data_utils.rand_name('server')
new_name = ''
- self.assertRaises(exceptions.BadRequest, self.client.update_server,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_server,
server_name, name=new_name)
@test.attr(type=['negative', 'gate'])
@@ -249,7 +248,7 @@
# Update name of server exceed the name length limit
new_name = 'a' * 256
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_server,
self.server_id,
name=new_name)
@@ -287,7 +286,7 @@
# Create a server with a nonexistent security group
security_groups = [{'name': 'does_not_exist'}]
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
security_groups=security_groups)
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 10d8bfa..754b15a 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -21,7 +21,6 @@
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
@@ -168,7 +167,7 @@
@test.attr(type='gate')
def test_create_server_with_unauthorized_image(self):
# Server creation with another user's image should fail
- self.assertRaises(exceptions.BadRequest, self.alt_client.create_server,
+ self.assertRaises(lib_exc.BadRequest, self.alt_client.create_server,
'test', self.image['id'], self.flavor_ref)
@test.attr(type='gate')
@@ -180,7 +179,7 @@
request_part='url',
auth_data=self.client.auth_provider.auth_data
)
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_client.create_server, 'test',
self.image['id'], self.flavor_ref)
@@ -198,7 +197,7 @@
)
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_keypairs_client.create_keypair, k_name)
finally:
# Next request the base_url is back to normal
@@ -249,7 +248,7 @@
)
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_security_client.create_security_group,
s_name, s_description)
finally:
@@ -290,7 +289,7 @@
)
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_security_client.
create_security_group_rule,
parent_group_id, ip_protocol, from_port,
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index 1583278..586bc5c 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -48,6 +48,6 @@
server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
- self.assertRaises(exceptions.BadRequest, self._migrate_server_to,
+ self.assertRaises(lib_exc.BadRequest, self._migrate_server_to,
server_id, target_host)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index 53253c9..ed54aaf 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -20,7 +20,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -58,7 +57,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -67,7 +66,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -75,7 +74,7 @@
# Negative: Should not be able to create volume with size zero
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index 2c51715..c38e6e0 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -18,7 +18,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -49,7 +48,7 @@
@test.attr(type=['negative', 'gate'])
def test_role_create_blank_name(self):
# Should not be able to create a role with a blank name
- self.assertRaises(exceptions.BadRequest, self.client.create_role, '')
+ self.assertRaises(lib_exc.BadRequest, self.client.create_role, '')
@test.attr(type=['negative', 'gate'])
def test_create_role_by_unauthorized_user(self):
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 16ea96a..db51f14 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -18,7 +18,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -99,14 +98,14 @@
@test.attr(type=['negative', 'gate'])
def test_create_tenant_with_empty_name(self):
# Tenant name should not be empty
- self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_tenant,
name='')
@test.attr(type=['negative', 'gate'])
def test_create_tenants_name_length_over_64(self):
# Tenant name length should not be greater than 64 characters
tenant_name = 'a' * 65
- self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_tenant,
tenant_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/test_users_negative.py b/tempest/api/identity/admin/test_users_negative.py
index db8c564..99993b9 100644
--- a/tempest/api/identity/admin/test_users_negative.py
+++ b/tempest/api/identity/admin/test_users_negative.py
@@ -18,7 +18,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -44,7 +43,7 @@
def test_create_user_with_empty_name(self):
# User with an empty name should not be created
self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user, '',
+ self.assertRaises(lib_exc.BadRequest, self.client.create_user, '',
self.alt_password, self.data.tenant['id'],
self.alt_email)
@@ -52,7 +51,7 @@
def test_create_user_with_name_length_over_255(self):
# Length of user name filed should be restricted to 255 characters
self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_user,
'a' * 256, self.alt_password,
self.data.tenant['id'], self.alt_email)
@@ -91,7 +90,7 @@
# Attempt to create a user with valid enabled para should fail
self.data.setup_test_tenant()
name = data_utils.rand_name('test_user_')
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_user,
name, self.alt_password,
self.data.tenant['id'],
self.alt_email, enabled=3)
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 9846010..cf41f9c 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -14,10 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -50,7 +50,7 @@
interface = 'public'
url = data_utils.rand_url()
region = data_utils.rand_name('region')
- self.assertRaises(exceptions.BadRequest, self.client.create_endpoint,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
self.service_id, interface, url, region=region,
force_enabled='False')
@@ -60,7 +60,7 @@
interface = 'public'
url = data_utils.rand_url()
region = data_utils.rand_name('region')
- self.assertRaises(exceptions.BadRequest, self.client.create_endpoint,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
self.service_id, interface, url, region=region,
force_enabled='True')
@@ -75,7 +75,7 @@
url1, region=region1, enabled=True))
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
- self.assertRaises(exceptions.BadRequest, self.client.update_endpoint,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint,
endpoint_for_update['id'], force_enabled=enabled)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index fc013c5..a194198 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -17,7 +17,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -50,14 +49,14 @@
@test.attr(type=['negative', 'gate'])
def test_create_project_with_empty_name(self):
# Project name should not be empty
- self.assertRaises(exceptions.BadRequest, self.client.create_project,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_project,
name='')
@test.attr(type=['negative', 'gate'])
def test_create_projects_name_length_over_64(self):
# Project name length should not be greater than 64 characters
project_name = 'a' * 65
- self.assertRaises(exceptions.BadRequest, self.client.create_project,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_project,
project_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index fd62004..48201ec 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -20,7 +20,6 @@
from tempest.common import cred_provider
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import timeutils
from tempest import test
@@ -237,7 +236,7 @@
# is rejected with the correct error
# with an expiry specified
expires_str = 'bad.123Z'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_trust,
expires=expires_str)
diff --git a/tempest/api/image/v1/test_images_negative.py b/tempest/api/image/v1/test_images_negative.py
index b144a83..698bac0 100644
--- a/tempest/api/image/v1/test_images_negative.py
+++ b/tempest/api/image/v1/test_images_negative.py
@@ -16,7 +16,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
-from tempest import exceptions
from tempest import test
@@ -26,12 +25,12 @@
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_container_format(self):
# Negative tests for invalid data supplied to POST /images
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'wrong', 'vhd')
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_disk_format(self):
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'bare', 'wrong')
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index 4402af9..068a6e5 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -13,7 +13,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
-from tempest import exceptions
from tempest import test
@@ -25,7 +24,7 @@
member = self.os_img_client.add_member(image_id,
self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_img_client.update_member_status,
image_id, self.alt_tenant_id, 'notavalidstatus')
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index d32fc3b..9f0ad2d 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -19,7 +19,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
-from tempest import exceptions
from tempest import test
@@ -85,10 +84,10 @@
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_container_format(self):
# Negative tests for invalid data supplied to POST /images
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'wrong', 'vhd')
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_disk_format(self):
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'bare', 'wrong')
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 4cb1485..e8c8de3 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -223,7 +223,7 @@
gateway_ip=gateway_ip,
**kwargs)
break
- except exceptions.BadRequest as e:
+ except lib_exc.BadRequest as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
if not is_overlapping_cidr:
raise
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index f7a6fb7..1b28bac 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -21,7 +21,6 @@
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
CONF = config.CONF
@@ -146,7 +145,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_subnet,
self.network,
**kwargs)
@@ -329,7 +328,7 @@
subnet["allocation_pools"][0]["end"])
ip = netaddr.IPAddress(random.randrange(
ip_range.last + 1, ip_range.last + 10)).format()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_port,
self.network,
fixed_ips=[{'subnet_id': subnet['id'],
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
index 81eedd4..7d70976 100644
--- a/tempest/api/network/test_floating_ips_negative.py
+++ b/tempest/api/network/test_floating_ips_negative.py
@@ -19,7 +19,6 @@
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -59,7 +58,7 @@
@test.attr(type=['negative', 'smoke'])
def test_create_floatingip_in_private_network(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_floatingip,
floating_network_id=self.network['id'],
port_id=self.port['id'],
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index 655fa58..67a6c94 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -19,7 +19,6 @@
from tempest.api.network import base_routers as base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -54,7 +53,7 @@
network_name=data_utils.rand_name('router-negative-'))
sub_cidr = netaddr.IPNetwork(self.tenant_cidr).next()
self.create_subnet(alt_network, cidr=sub_cidr)
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_router,
self.router['id'],
external_gateway_info={
@@ -70,7 +69,7 @@
subnet02 = self.create_subnet(network02)
self._add_router_interface_with_subnet_id(self.router['id'],
subnet01['id'])
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self._add_router_interface_with_subnet_id,
self.router['id'],
subnet02['id'])
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index 47b218c..0da1aac 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -19,7 +19,6 @@
from tempest.api.network import base_security_groups as base
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -64,7 +63,7 @@
# Create rule with bad protocol name
pname = 'bad_protocol_name'
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol=pname, direction='ingress', ethertype=self.ethertype)
@@ -76,7 +75,7 @@
prefix = ['192.168.1./24', '192.168.1.1/33', 'bad_prefix', '256']
for remote_ip_prefix in prefix:
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='tcp', direction='ingress', ethertype=self.ethertype,
remote_ip_prefix=remote_ip_prefix)
@@ -103,7 +102,7 @@
# Create rule specifying both remote_ip_prefix and remote_group_id
prefix = self._tenant_network_cidr
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=sg1_body['security_group']['id'],
protocol='tcp', direction='ingress',
ethertype=self.ethertype, remote_ip_prefix=prefix,
@@ -116,7 +115,7 @@
# Create rule with bad ethertype
ethertype = 'bad_ethertype'
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='udp', direction='ingress', ethertype=ethertype)
@@ -132,7 +131,7 @@
(-16, 65536, 'Invalid value for port')]
for pmin, pmax, msg in states:
ex = self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='tcp', port_range_min=pmin, port_range_max=pmax,
direction='ingress', ethertype=self.ethertype)
@@ -144,7 +143,7 @@
(300, 1, 'Invalid value for ICMP type')]
for pmin, pmax, msg in states:
ex = self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='icmp', port_range_min=pmin, port_range_max=pmax,
direction='ingress', ethertype=self.ethertype)
@@ -207,7 +206,7 @@
'ip_prefix': CONF.network.tenant_network_v6_cidr})
for pair in pairs:
self.assertRaisesRegexp(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
"Conflicting value ethertype",
self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
diff --git a/tempest/api/orchestration/stacks/test_limits.py b/tempest/api/orchestration/stacks/test_limits.py
index 8ee62ab..5f7f954 100644
--- a/tempest/api/orchestration/stacks/test_limits.py
+++ b/tempest/api/orchestration/stacks/test_limits.py
@@ -11,11 +11,11 @@
# under the License.
import logging
+from tempest_lib import exceptions as lib_exc
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -34,7 +34,7 @@
Description: '%s'
Outputs:
Foo: bar''' % fill
- ex = self.assertRaises(exceptions.BadRequest, self.create_stack,
+ ex = self.assertRaises(lib_exc.BadRequest, self.create_stack,
stack_name, template)
self.assertIn('Template exceeds maximum allowed size', str(ex))
@@ -48,6 +48,6 @@
for i in range(num_resources):
template += rsrc_snippet % i
- ex = self.assertRaises(exceptions.BadRequest, self.create_stack,
+ ex = self.assertRaises(lib_exc.BadRequest, self.create_stack,
stack_name, template)
self.assertIn('Maximum resources per stack exceeded', str(ex))
diff --git a/tempest/api/orchestration/stacks/test_templates_negative.py b/tempest/api/orchestration/stacks/test_templates_negative.py
index 9082107..9a5bc68 100644
--- a/tempest/api/orchestration/stacks/test_templates_negative.py
+++ b/tempest/api/orchestration/stacks/test_templates_negative.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.orchestration import base
-from tempest import exceptions
from tempest import test
@@ -37,7 +38,7 @@
@test.attr(type=['gate', 'negative'])
def test_validate_template_url(self):
"""Validating template passing url to it."""
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.validate_template_url,
template_url=self.invalid_template_url,
parameters=self.parameters)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index 2f3b382..23979cd 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -19,7 +19,6 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -44,7 +43,7 @@
# Should not update volume type extra specs with no body
extra_spec = {"spec1": "val2"}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0], None)
@@ -53,7 +52,7 @@
# Should not update volume type extra specs with nonexistent id.
extra_spec = {"spec1": "val2"}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], str(uuid.uuid4()),
extra_spec)
@@ -63,7 +62,7 @@
# Should not update volume type extra specs with none id.
extra_spec = {"spec1": "val2"}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], None, extra_spec)
@@ -73,7 +72,7 @@
# body.
extra_spec = {"spec1": "val2", 'spec2': 'val1'}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0],
extra_spec)
@@ -92,7 +91,7 @@
def test_create_none_body(self):
# Should not create volume type extra spec for none POST body.
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
self.volume_type['id'], None)
@@ -100,7 +99,7 @@
def test_create_invalid_body(self):
# Should not create volume type extra spec for invalid POST body.
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
self.volume_type['id'], ['invalid'])
diff --git a/tempest/api/volume/admin/test_volume_types_negative.py b/tempest/api/volume/admin/test_volume_types_negative.py
index 77ca34c..a40f1c4 100644
--- a/tempest/api/volume/admin/test_volume_types_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_negative.py
@@ -18,7 +18,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.volume import base
-from tempest import exceptions
from tempest import test
@@ -37,7 +36,7 @@
@test.attr(type='gate')
def test_create_with_empty_name(self):
# Should not be able to create volume type with an empty name.
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.volume_types_client.create_volume_type, '')
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 39aba01..595ddf4 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -19,7 +19,6 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -54,7 +53,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -63,7 +62,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -71,7 +70,7 @@
# Should not be able to create volume with size zero
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -79,7 +78,7 @@
# Should not be able to create volume with size negative
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='-1', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -180,21 +179,21 @@
def test_volume_extend_with_size_smaller_than_original_size(self):
# Extend volume with smaller size than original size.
extend_size = 0
- self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_non_number_size(self):
# Extend volume when size is non number.
extend_size = 'abc'
- self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_None_size(self):
# Extend volume with None size.
extend_size = None
- self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@test.attr(type=['negative', 'gate'])
@@ -228,7 +227,7 @@
# Mark volume as reserved.
self.client.reserve_volume(self.volume['id'])
# Mark volume which is marked as reserved before
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reserve_volume,
self.volume['id'])
# Unmark volume as reserved.
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index b383c50..e9b6621 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -115,7 +115,6 @@
import tempest.auth
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.openstack.common import timeutils
from tempest.services.compute.json import flavors_client
@@ -705,7 +704,7 @@
cidr=subnet['range'],
name=subnet['name'],
ip_version=ip_version)
- except exceptions.BadRequest as e:
+ except lib_exc.BadRequest as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
if not is_overlapping_cidr:
raise
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 1cfb963..f81c3ed 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -198,7 +198,7 @@
tenant_id=tenant_id,
ip_version=4)
break
- except exceptions.BadRequest as e:
+ except lib_exc.BadRequest as e:
if 'overlaps with another subnet' not in str(e):
raise
else:
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index 0812b99..8949609 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -16,7 +16,6 @@
from tempest_lib import exceptions as lib_exceptions
from tempest import config
-from tempest import exceptions
CONF = config.CONF
@@ -59,8 +58,6 @@
method, url,
extra_headers=extra_headers,
headers=headers, body=body)
- except lib_exceptions.BadRequest as ex:
- raise exceptions.BadRequest(ex)
# TODO(oomichi): This is just a workaround for failing gate tests
# when separating Forbidden from Unauthorized in tempest-lib.
# We will need to remove this translation and replace negative tests