Merge "Fix dhcpv6-stateful tempest test to validate only valid use-case"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 86dda80..441e17c 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -248,7 +248,9 @@
# Time in seconds between build status checks. (integer value)
#build_interval = 1
-# Timeout in seconds to wait for an instance to build. (integer value)
+# Timeout in seconds to wait for an instance to build. Other services
+# that do not define build_timeout will inherit this value, for
+# example the image service. (integer value)
#build_timeout = 300
# Catalog type of the Compute service. (string value)
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 80dea10..5643c88 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -60,7 +60,7 @@
body = self.client.list_ports()
ports = body['ports']
for port in ports:
- if (port['device_owner'] == 'network:router_interface'
+ if (port['device_owner'].startswith('network:router_interface')
and port['device_id'] in [r['id'] for r in self.routers]):
self.client.remove_router_interface_with_port_id(
port['device_id'], port['id']
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index fa1f6ee..fb51e30 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -193,3 +193,22 @@
class NegativeSecGroupIPv6Test(NegativeSecGroupTest):
_ip_version = 6
_tenant_network_cidr = CONF.network.tenant_network_v6_cidr
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_security_group_rule_wrong_ip_prefix_version(self):
+ group_create_body, _ = self._create_security_group()
+
+ # Create rule with bad remote_ip_prefix
+ pairs = ({'ethertype': 'IPv6',
+ 'ip_prefix': CONF.network.tenant_network_cidr},
+ {'ethertype': 'IPv4',
+ 'ip_prefix': CONF.network.tenant_network_v6_cidr})
+ for pair in pairs:
+ self.assertRaisesRegexp(
+ exceptions.BadRequest,
+ "Conflicting value ethertype",
+ self.client.create_security_group_rule,
+ security_group_id=group_create_body['security_group']['id'],
+ protocol='tcp', direction='ingress',
+ ethertype=pair['ethertype'],
+ remote_ip_prefix=pair['ip_prefix'])
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 21d0a86..b7e9422 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -70,11 +70,14 @@
self.addCleanup(self.servers_client.delete_server, server['id'])
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
- _, body = self.volumes_client.attach_volume(
- self.volume_origin['id'], server['id'], mountpoint)
+ _, body = self.servers_client.attach_volume(
+ server['id'], self.volume_origin['id'], mountpoint)
self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
'in-use')
- self.addCleanup(self._detach, self.volume_origin['id'])
+ self.addCleanup(self.volumes_client.wait_for_volume_status,
+ self.volume_origin['id'], 'available')
+ self.addCleanup(self.servers_client.detach_volume, server['id'],
+ self.volume_origin['id'])
# Snapshot a volume even if it's attached to an instance
snapshot = self.create_snapshot(self.volume_origin['id'],
force=True)
diff --git a/tempest/auth.py b/tempest/auth.py
index 022a450..2550cfb 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -561,7 +561,10 @@
raise exceptions.InvalidCredentials()
creds = cls._get_default(credentials_type)
if not creds.is_valid():
- raise exceptions.InvalidConfiguration()
+ msg = ("The %s credentials are incorrectly set in the config file."
+ " Double check that all required values are assigned" %
+ credentials_type)
+ raise exceptions.InvalidConfiguration(msg)
return creds
@classmethod
diff --git a/tempest/config.py b/tempest/config.py
index cc6d626..dbe9bc2 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -185,7 +185,9 @@
help="Time in seconds between build status checks."),
cfg.IntOpt('build_timeout',
default=300,
- help="Timeout in seconds to wait for an instance to build."),
+ help="Timeout in seconds to wait for an instance to build. "
+ "Other services that do not define build_timeout will "
+ "inherit this value, for example the image service."),
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
diff --git a/tempest/services/identity/v3/json/base.py b/tempest/services/identity/v3/json/base.py
new file mode 100644
index 0000000..3df0dab
--- /dev/null
+++ b/tempest/services/identity/v3/json/base.py
@@ -0,0 +1,30 @@
+# Copyright 2014 NEC Corporation. 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 tempest.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class IdentityV3Client(rest_client.RestClient):
+ """
+ Base identity v3 client class
+ """
+
+ def __init__(self, auth_provider):
+ super(IdentityV3Client, self).__init__(auth_provider)
+ self.service = CONF.identity.catalog_type
+ self.endpoint_url = 'adminURL'
+ self.api_version = "v3"
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index d424f4c..42acd2a 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -15,19 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class CredentialsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(CredentialsClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class CredentialsClientJSON(base.IdentityV3Client):
def create_credential(self, access_key, secret_key, user_id, project_id):
"""Creates a credential."""
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index c3fedb2..9316a4b 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -15,19 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class EndPointClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(EndPointClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class EndPointClientJSON(base.IdentityV3Client):
def list_endpoints(self):
"""GET endpoints."""
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 6ac4901..4c8d8df 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -19,17 +19,12 @@
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.identity.v3.json import base
CONF = config.CONF
-class IdentityV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(IdentityV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class IdentityV3ClientJSON(base.IdentityV3Client):
def create_user(self, user_name, password=None, project_id=None,
email=None, domain_id='default', **kwargs):
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index 579243c..04374a2 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -16,18 +16,10 @@
import json
from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class PolicyClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(PolicyClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class PolicyClientJSON(base.IdentityV3Client):
def create_policy(self, blob, type):
"""Creates a Policy."""
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index becea6b..8545778 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -16,19 +16,10 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class RegionClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(RegionClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class RegionClientJSON(base.IdentityV3Client):
def create_region(self, description, **kwargs):
"""Create region."""
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 8e89957..b8b2556 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -15,19 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class ServiceClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ServiceClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class ServiceClientJSON(base.IdentityV3Client):
def update_service(self, service_id, **kwargs):
"""Updates a service."""
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index 10cb0be..e7add30 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -16,24 +16,14 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeHostsClientJSON(rest_client.RestClient):
+class BaseVolumeHostsClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseVolumeHostsClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def list_hosts(self, params=None):
"""Lists all hosts."""
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index 5b49040..f08cb64 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -16,27 +16,17 @@
import urllib
-from tempest.common import rest_client
-from tempest import config
from tempest.openstack.common import jsonutils
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeQuotasClientJSON(rest_client.RestClient):
+class BaseVolumeQuotasClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume Quotas API requests to a Cinder endpoint
"""
TYPE = "json"
- def __init__(self, auth_provider):
- super(BaseVolumeQuotasClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def get_default_quota_set(self, tenant_id):
"""List the default volume quota set for a tenant."""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index 88c6db0..5d4f9db 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -16,17 +16,10 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumesServicesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(BaseVolumesServicesClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
+class BaseVolumesServicesClientJSON(base.VolumeClient):
def list_services(self, params=None):
url = 'os-services'
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index eedf880..171ad35 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -16,25 +16,15 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeTypesClientJSON(rest_client.RestClient):
+class BaseVolumeTypesClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume Types API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseVolumeTypesClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def is_resource_deleted(self, resource):
# to use this method self.resource must be defined to respective value
# Resource is a dictionary containing resource id and type
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 5ad2287..9f2c570 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -15,18 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeAvailabilityZoneClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(BaseVolumeAvailabilityZoneClientJSON, self).__init__(
- auth_provider)
- self.service = CONF.volume.catalog_type
+class BaseVolumeAvailabilityZoneClientJSON(base.VolumeClient):
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index 51a017e..e2ba822 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -16,24 +16,15 @@
import json
import time
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseBackupsClientJSON(rest_client.RestClient):
+class BaseBackupsClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume backup API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseBackupsClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def create_backup(self, volume_id, container=None, name=None,
description=None):
"""Creates a backup of volume."""
diff --git a/tempest/services/volume/json/base.py b/tempest/services/volume/json/base.py
new file mode 100644
index 0000000..8bc2f93
--- /dev/null
+++ b/tempest/services/volume/json/base.py
@@ -0,0 +1,30 @@
+# Copyright 2014 NEC Corporation. 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 tempest.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class VolumeClient(rest_client.RestClient):
+ """
+ Base volume client class
+ """
+
+ def __init__(self, auth_provider):
+ super(VolumeClient, self).__init__(auth_provider)
+ self.service = CONF.volume.catalog_type
+ self.build_interval = CONF.volume.build_interval
+ self.build_timeout = CONF.volume.build_timeout
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index c84b186..13b91c3 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -15,17 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseExtensionsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(BaseExtensionsClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
+class BaseExtensionsClientJSON(base.VolumeClient):
def list_extensions(self):
url = 'extensions'
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index b647bc7..9c13cac 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -15,22 +15,13 @@
import json
import time
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseQosSpecsClientJSON(rest_client.RestClient):
+class BaseQosSpecsClientJSON(base.VolumeClient):
"""Client class to send CRUD QoS API requests"""
- def __init__(self, auth_provider):
- super(BaseQosSpecsClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def is_resource_deleted(self, qos_id):
try:
self.get_qos(qos_id)
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index e9d5b83..349d1b0 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -14,26 +14,18 @@
import time
import urllib
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
+from tempest.services.volume.json import base
-CONF = config.CONF
LOG = logging.getLogger(__name__)
-class BaseSnapshotsClientJSON(rest_client.RestClient):
+class BaseSnapshotsClientJSON(base.VolumeClient):
"""Base Client class to send CRUD Volume API requests."""
- def __init__(self, auth_provider):
- super(BaseSnapshotsClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
- self.create_resp = 200
+ create_resp = 200
def list_snapshots(self, params=None):
"""List all the snapshot."""
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 1e49e5a..f19718e 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -17,25 +17,19 @@
import time
import urllib
-from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.volume.json import base
CONF = config.CONF
-class BaseVolumesClientJSON(rest_client.RestClient):
+class BaseVolumesClientJSON(base.VolumeClient):
"""
Base client class to send CRUD Volume API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseVolumesClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
- self.create_resp = 200
+ create_resp = 200
def get_attachment_from_volume(self, volume):
"""Return the element 'attachment' from input volumes."""
diff --git a/tempest/test.py b/tempest/test.py
index 6deb42b..886e7bb 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -321,20 +321,6 @@
del trace # to avoid circular refs
@classmethod
- def resource_setup(cls):
- """Class level resource setup for test cases.
- """
- pass
-
- @classmethod
- def resource_cleanup(cls):
- """Class level resource cleanup for test cases.
- Resource cleanup must be able to handle the case of partially setup
- resources, in case a failure during `resource_setup` should happen.
- """
- pass
-
- @classmethod
def skip_checks(cls):
"""Class level skip checks. Subclasses verify in here all
conditions that might prevent the execution of the entire test class.
@@ -362,6 +348,20 @@
# specify which client is `client` and nothing else.
pass
+ @classmethod
+ def resource_setup(cls):
+ """Class level resource setup for test cases.
+ """
+ pass
+
+ @classmethod
+ def resource_cleanup(cls):
+ """Class level resource cleanup for test cases.
+ Resource cleanup must be able to handle the case of partially setup
+ resources, in case a failure during `resource_setup` should happen.
+ """
+ pass
+
def setUp(self):
super(BaseTestCase, self).setUp()
if not self.setUpClassCalled:
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 00b17d9..707590e 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -157,19 +157,24 @@
instance.add_tag('key1', value='value1')
tags = self.ec2_client.get_all_tags()
- self.assertEqual(tags[0].name, 'key1')
- self.assertEqual(tags[0].value, 'value1')
+ td = {item.name: item.value for item in tags}
+
+ self.assertIn('key1', td)
+ self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'key1'})
- self.assertEqual(tags[0].name, 'key1')
- self.assertEqual(tags[0].value, 'value1')
+ td = {item.name: item.value for item in tags}
+ self.assertIn('key1', td)
+ self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'value': 'value1'})
- self.assertEqual(tags[0].name, 'key1')
- self.assertEqual(tags[0].value, 'value1')
+ td = {item.name: item.value for item in tags}
+ self.assertIn('key1', td)
+ self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'value2'})
- self.assertEqual(len(tags), 0, str(tags))
+ td = {item.name: item.value for item in tags}
+ self.assertNotIn('key1', td)
for instance in reservation.instances:
instance.remove_tag('key1', value='value1')