Merge "Replace assertDictMatch with assertDictEqual method in tests"

This commit is contained in:
Jenkins 2016-12-22 10:28:32 +00:00 committed by Gerrit Code Review
commit 477586c3e3
49 changed files with 301 additions and 358 deletions

View File

@ -320,63 +320,6 @@ class TestCase(testtools.TestCase):
return result
# Useful assertions
def assertDictMatch(self, d1, d2, approx_equal=False, tolerance=0.001):
"""Assert two dicts are equivalent.
This is a 'deep' match in the sense that it handles nested
dictionaries appropriately.
NOTE:
If you don't care (or don't know) a given value, you can specify
the string DONTCARE as the value. This will cause that dict-item
to be skipped.
"""
def raise_assertion(msg):
d1str = d1
d2str = d2
base_msg = ('Dictionaries do not match. %(msg)s d1: %(d1str)s '
'd2: %(d2str)s' %
{'msg': msg, 'd1str': d1str, 'd2str': d2str})
raise AssertionError(base_msg)
d1keys = set(d1.keys())
d2keys = set(d2.keys())
if d1keys != d2keys:
d1only = d1keys - d2keys
d2only = d2keys - d1keys
raise_assertion('Keys in d1 and not d2: %(d1only)s. '
'Keys in d2 and not d1: %(d2only)s' %
{'d1only': d1only, 'd2only': d2only})
for key in d1keys:
d1value = d1[key]
d2value = d2[key]
try:
error = abs(float(d1value) - float(d2value))
within_tolerance = error <= tolerance
except (ValueError, TypeError):
# If both values aren't convertible to float, just ignore
# ValueError if arg is a str, TypeError if it's something else
# (like None)
within_tolerance = False
if hasattr(d1value, 'keys') and hasattr(d2value, 'keys'):
self.assertDictMatch(d1value, d2value)
elif 'DONTCARE' in (d1value, d2value):
continue
elif approx_equal and within_tolerance:
continue
elif d1value != d2value:
raise_assertion("d1['%(key)s']=%(d1value)s != "
"d2['%(key)s']=%(d2value)s" %
{
'key': key,
'd1value': d1value,
'd2value': d2value,
})
def assert_notify_called(self, mock_notify, calls):
for i in range(0, len(calls)):
mock_call = mock_notify.call_args_list[i]

View File

@ -107,7 +107,7 @@ class CapabilitiesAPITest(test.TestCase):
}
}
self.assertDictMatch(expected, res)
self.assertDictEqual(expected, res)
@mock.patch('cinder.db.service_get_all')
@mock.patch('cinder.volume.rpcapi.VolumeAPI.get_capabilities')

View File

@ -489,7 +489,7 @@ class QoSSpecManageApiTest(test.TestCase):
body = {'qos_specs': {'key1': 'value1',
'key2': 'value2'}}
res = self.controller.update(req, fake.QOS_SPEC_ID, body)
self.assertDictMatch(body, res)
self.assertDictEqual(body, res)
self.assertEqual(1, notifier.get_notification_count())
@mock.patch('cinder.volume.qos_specs.update',

View File

@ -165,11 +165,11 @@ class QuotaSetsControllerTestBase(test.TestCase):
class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
def test_defaults(self):
result = self.controller.defaults(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result)
self.assertDictEqual(make_body(), result)
def test_show(self):
result = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result)
self.assertDictEqual(make_body(), result)
def test_show_not_authorized(self):
self.req.environ['cinder.context'].is_admin = False
@ -182,7 +182,7 @@ class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
self.controller._get_quotas = mock.Mock(side_effect=
self.controller._get_quotas)
result = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result)
self.assertDictEqual(make_body(), result)
self.controller._get_quotas.assert_called_with(
self.req.environ['cinder.context'], fake.PROJECT_ID, False)
@ -195,17 +195,17 @@ class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
def test_show_with_valid_usage_param(self):
self.req.params = {'usage': 'false'}
result = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result)
self.assertDictEqual(make_body(), result)
def test_update(self):
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, fake.PROJECT_ID, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
body = make_body(gigabytes=db.MAX_INT, tenant_id=None)
result = self.controller.update(self.req, fake.PROJECT_ID, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
def test_update_subproject_not_in_hierarchy_non_nested(self):
# When not using nested quotas, the hierarchy should not be considered
@ -221,7 +221,7 @@ class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Try to update the quota of F, it will be allowed even though
# project E doesn't belong to the project hierarchy of A, because
# we are NOT using the nested quota driver
@ -267,7 +267,7 @@ class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
self.req, fake.PROJECT_ID, body)
# Verify that quota values are not updated in db
new_quota = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(orig_quota, new_quota)
self.assertDictEqual(orig_quota, new_quota)
def test_update_bad_quota_limit(self):
body = {'quota_set': {'gigabytes': -1000}}
@ -337,18 +337,18 @@ class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
def test_delete(self):
result_show = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result_show)
self.assertDictEqual(make_body(), result_show)
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5,
backup_gigabytes=1000, tenant_id=None)
result_update = self.controller.update(self.req, fake.PROJECT_ID, body)
self.assertDictMatch(body, result_update)
self.assertDictEqual(body, result_update)
self.controller.delete(self.req, fake.PROJECT_ID)
result_show_after = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(result_show, result_show_after)
self.assertDictEqual(result_show, result_show_after)
def test_delete_with_allocated_quota_different_from_zero(self):
self.req.environ['cinder.context'].project_id = self.A.id
@ -357,19 +357,19 @@ class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
volumes=5, backups=5,
backup_gigabytes=1000, tenant_id=None)
result_update = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result_update)
self.assertDictEqual(body, result_update)
# Set usage param to True in order to see get allocated values.
self.req.params = {'usage': 'True'}
result_show = self.controller.show(self.req, self.A.id)
result_update = self.controller.update(self.req, self.B.id, body)
self.assertDictMatch(body, result_update)
self.assertDictEqual(body, result_update)
self.controller.delete(self.req, self.B.id)
result_show_after = self.controller.show(self.req, self.A.id)
self.assertDictMatch(result_show, result_show_after)
self.assertDictEqual(result_show, result_show_after)
def test_delete_no_admin(self):
self.req.environ['cinder.context'].is_admin = False
@ -594,13 +594,13 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
context.project_id = self.B.id
result = self.controller.defaults(self.req, self.B.id)
expected = make_subproject_body(tenant_id=self.B.id)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
def test_subproject_show(self):
self.req.environ['cinder.context'].project_id = self.A.id
result = self.controller.show(self.req, self.B.id)
expected = make_subproject_body(tenant_id=self.B.id)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
def test_subproject_show_in_hierarchy(self):
# A user scoped to a root project in a hierarchy can see its children
@ -608,13 +608,13 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
self.req.environ['cinder.context'].project_id = self.A.id
result = self.controller.show(self.req, self.D.id)
expected = make_subproject_body(tenant_id=self.D.id)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
# A user scoped to a parent project can see its immediate children
# quotas.
self.req.environ['cinder.context'].project_id = self.B.id
result = self.controller.show(self.req, self.D.id)
expected = make_subproject_body(tenant_id=self.D.id)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
def test_subproject_show_not_in_hierarchy_admin_context(self):
E = self.FakeProject(id=uuid.uuid4().hex, parent_id=None,
@ -623,14 +623,14 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
self.req.environ['cinder.context'].project_id = E.id
result = self.controller.show(self.req, self.B.id)
expected = make_subproject_body(tenant_id=self.B.id)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
def test_subproject_show_target_project_equals_to_context_project(
self):
self.req.environ['cinder.context'].project_id = self.B.id
result = self.controller.show(self.req, self.B.id)
expected = make_subproject_body(tenant_id=self.B.id)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
def test_subproject_show_not_authorized(self):
self.req.environ['cinder.context'].project_id = self.B.id
@ -653,7 +653,7 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Try to update the quota of F, it will not be allowed, since the
# project E doesn't belongs to the project hierarchy of A.
self.req.environ['cinder.context'].project_id = self.A.id
@ -672,10 +672,10 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
# Update the project A quota, not in the project hierarchy
# of E but it will be allowed because E is the cloud admin.
result = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Update the quota of B to be equal to its parent A.
result = self.controller.update(self.req, self.B.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Remove the admin role from project E
E.is_admin_project = False
# Now updating the quota of B will fail, because it is not
@ -689,13 +689,13 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Update the quota of B to be equal to its parent quota
self.req.environ['cinder.context'].project_id = self.A.id
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.B.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Try to update the quota of C, it will not be allowed, since the
# project A doesn't have free quota available.
self.req.environ['cinder.context'].project_id = self.A.id
@ -708,7 +708,7 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=1000, snapshots=7,
volumes=3, backups=3, tenant_id=None)
result = self.controller.update(self.req, self.D.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# An admin of B can also update the quota of D, since D is its
# immediate child.
self.req.environ['cinder.context'].project_id = self.B.id
@ -722,7 +722,7 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=10, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Update the quota of B to be equal to its parent quota
# three times should be successful, the quota will not be
# allocated to 'allocated' value of parent project
@ -731,7 +731,7 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=10, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.B.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
def test_update_subproject_with_not_root_context_project(self):
# Update the project A quota.
@ -739,7 +739,7 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
# Try to update the quota of B, it will not be allowed, since the
# project in the context (B) is not a root project.
self.req.environ['cinder.context'].project_id = self.B.id
@ -756,7 +756,7 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
expected = make_body(gigabytes=1000, snapshots=10,
volumes=5, backups=5, tenant_id=None)
result = self.controller.update(self.req, self.B.id, expected)
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
def _assert_quota_show(self, proj_id, resource, in_use=0, reserved=0,
allocated=0, limit=0):
@ -828,19 +828,19 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase):
body = make_body(gigabytes=2000, snapshots=15, volumes=5, backups=5,
backup_gigabytes=1000, tenant_id=None)
result_update = self.controller.update(self.req, self.A.id, body)
self.assertDictMatch(body, result_update)
self.assertDictEqual(body, result_update)
# Set usage param to True in order to see get allocated values.
self.req.params = {'usage': 'True'}
result_show = self.controller.show(self.req, self.A.id)
result_update = self.controller.update(self.req, self.B.id, body)
self.assertDictMatch(body, result_update)
self.assertDictEqual(body, result_update)
self.controller.delete(self.req, self.B.id)
result_show_after = self.controller.show(self.req, self.A.id)
self.assertDictMatch(result_show, result_show_after)
self.assertDictEqual(result_show, result_show_after)
def test_subproject_delete_not_considering_default_quotas(self):
"""Test delete subprojects' quotas won't consider default quotas.

View File

@ -94,7 +94,7 @@ class QuotaClassSetsControllerTest(test.TestCase):
def test_show(self):
volume_types.create(self.ctxt, 'fake_type')
result = self.controller.show(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result)
self.assertDictEqual(make_body(), result)
def test_show_not_authorized(self):
self.req.environ['cinder.context'].is_admin = False
@ -108,7 +108,7 @@ class QuotaClassSetsControllerTest(test.TestCase):
body = make_body(gigabytes=2000, snapshots=15,
volumes=5, tenant_id=None)
result = self.controller.update(self.req, fake.PROJECT_ID, body)
self.assertDictMatch(body, result)
self.assertDictEqual(body, result)
@mock.patch('cinder.api.openstack.wsgi.Controller.validate_string_length')
@mock.patch('cinder.utils.validate_integer')
@ -125,7 +125,7 @@ class QuotaClassSetsControllerTest(test.TestCase):
volume_types.create(self.ctxt, 'fake_type')
body = {'quota_class_set': {'bad': 'bad'}}
result = self.controller.update(self.req, fake.PROJECT_ID, body)
self.assertDictMatch(make_body(tenant_id=None), result)
self.assertDictEqual(make_body(tenant_id=None), result)
def test_update_invalid_key_value(self):
body = {'quota_class_set': {'gigabytes': "should_be_int"}}
@ -149,7 +149,7 @@ class QuotaClassSetsControllerTest(test.TestCase):
body = {'quota_class_set': {'gigabytes_fake_type_1': 1111,
'volumes_fake_type_2': 2222}}
result = self.controller.update(self.req, fake.PROJECT_ID, body)
self.assertDictMatch(make_response_body(ctxt=self.ctxt,
self.assertDictEqual(make_response_body(ctxt=self.ctxt,
quota_class=fake.PROJECT_ID,
request_body=body,
tenant_id=None),

View File

@ -72,7 +72,7 @@ class SchedulerStatsAPITest(test.TestCase):
]
}
self.assertDictMatch(expected, res)
self.assertDictEqual(expected, res)
def test_get_pools_detail(self):
req = fakes.HTTPRequest.blank('/v2/%s/scheduler_stats?detail=True' %
@ -111,7 +111,7 @@ class SchedulerStatsAPITest(test.TestCase):
]
}
self.assertDictMatch(expected, res)
self.assertDictEqual(expected, res)
def test_get_pools_detail_invalid_bool(self):
req = fakes.HTTPRequest.blank(

View File

@ -859,7 +859,7 @@ class VolumeImageActionsTest(test.TestCase):
'container_format': 'bare',
'disk_format': 'raw',
'image_name': 'image_name'}}
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
def test_copy_volume_to_image_volumenotfound(self):
def fake_volume_get_raise_exc(self, context, volume_id):
@ -1019,11 +1019,11 @@ class VolumeImageActionsTest(test.TestCase):
expected = {
'os-volume_upload_image': {
'id': volume.id,
'updated_at': 'DONTCARE',
'updated_at': mock.ANY,
'status': 'uploading',
'display_description': 'displaydesc',
'size': 1,
'volume_type': 'DONTCARE',
'volume_type': mock.ANY,
'image_id': fake.IMAGE_ID,
'container_format': 'bare',
'disk_format': 'raw',
@ -1051,7 +1051,7 @@ class VolumeImageActionsTest(test.TestCase):
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
self.assertEqual('available', vol_db.previous_status)
@ -1092,7 +1092,7 @@ class VolumeImageActionsTest(test.TestCase):
body = self._get_os_volume_upload_image()
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
self.assertEqual('available', vol_db.previous_status)
@ -1182,7 +1182,7 @@ class VolumeImageActionsTest(test.TestCase):
CONF.set_default('enable_force_upload', True)
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
@ -1206,7 +1206,7 @@ class VolumeImageActionsTest(test.TestCase):
body = self._get_os_volume_upload_image()
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
self.assertEqual('available', vol_db.previous_status)
@ -1228,7 +1228,7 @@ class VolumeImageActionsTest(test.TestCase):
body = self._get_os_volume_upload_image()
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
self.assertEqual('available', vol_db.previous_status)
@ -1251,7 +1251,7 @@ class VolumeImageActionsTest(test.TestCase):
use_admin_context=self.context.is_admin)
body = self._get_os_volume_upload_image()
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
@mock.patch.object(volume_api.API, "get_volume_image_metadata")
@mock.patch.object(glance.GlanceImageService, "create")
@ -1289,7 +1289,7 @@ class VolumeImageActionsTest(test.TestCase):
expected['os-volume_upload_image'].update(visibility='public',
protected=True)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
@mock.patch.object(volume_api.API, "get_volume_image_metadata")
@mock.patch.object(glance.GlanceImageService, "create")
@ -1309,7 +1309,7 @@ class VolumeImageActionsTest(test.TestCase):
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
self.assertEqual('available', vol_db.previous_status)
@ -1332,7 +1332,7 @@ class VolumeImageActionsTest(test.TestCase):
res_dict = self.controller._volume_upload_image(req, volume.id, body)
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)
vol_db = objects.Volume.get_by_id(self.context, volume.id)
self.assertEqual('uploading', vol_db.status)
self.assertEqual('available', vol_db.previous_status)

View File

@ -786,7 +786,7 @@ class LimitsViewBuilderTest(test.TestCase):
output = self.view_builder.build(self.rate_limits,
self.absolute_limits)
self.assertDictMatch(expected_limits, output)
self.assertDictEqual(expected_limits, output)
def test_build_limits_empty_limits(self):
expected_limits = {"limits": {"rate": [],
@ -795,4 +795,4 @@ class LimitsViewBuilderTest(test.TestCase):
abs_limits = {}
rate_limits = []
output = self.view_builder.build(rate_limits, abs_limits)
self.assertDictMatch(expected_limits, output)
self.assertDictEqual(expected_limits, output)

View File

@ -132,7 +132,7 @@ class VolumeTypesApiTest(test.TestCase):
description=None,
is_public=None,
id=fake.VOLUME_TYPE_ID)
self.assertDictMatch(expected_volume_type, output['volume_type'])
self.assertDictEqual(expected_volume_type, output['volume_type'])
def test_view_builder_list(self):
view_builder = views_types.ViewBuilder()
@ -162,5 +162,5 @@ class VolumeTypesApiTest(test.TestCase):
id=volume_type_ids[i],
is_public=None,
description=None)
self.assertDictMatch(expected_volume_type,
self.assertDictEqual(expected_volume_type,
output['volume_types'][i])

View File

@ -792,7 +792,7 @@ class LimitsViewBuilderTest(test.TestCase):
output = self.view_builder.build(self.rate_limits,
self.absolute_limits)
self.assertDictMatch(expected_limits, output)
self.assertDictEqual(expected_limits, output)
def test_build_limits_empty_limits(self):
expected_limits = {"limits": {"rate": [],
@ -801,4 +801,4 @@ class LimitsViewBuilderTest(test.TestCase):
abs_limits = {}
rate_limits = []
output = self.view_builder.build(rate_limits, abs_limits)
self.assertDictMatch(expected_limits, output)
self.assertDictEqual(expected_limits, output)

View File

@ -300,7 +300,7 @@ class VolumeTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_volume_type, output['volume_type'])
self.assertDictEqual(expected_volume_type, output['volume_type'])
def test_view_builder_show_admin(self):
view_builder = views_types.ViewBuilder()
@ -331,7 +331,7 @@ class VolumeTypesApiTest(test.TestCase):
extra_specs={},
id=42,
)
self.assertDictMatch(expected_volume_type, output['volume_type'])
self.assertDictEqual(expected_volume_type, output['volume_type'])
def test_view_builder_show_qos_specs_id_policy(self):
with mock.patch.object(common,
@ -363,7 +363,7 @@ class VolumeTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_volume_type, output['volume_type'])
self.assertDictEqual(expected_volume_type, output['volume_type'])
def test_view_builder_show_extra_specs_policy(self):
with mock.patch.object(common,
@ -395,7 +395,7 @@ class VolumeTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_volume_type, output['volume_type'])
self.assertDictEqual(expected_volume_type, output['volume_type'])
def test_view_builder_show_pass_all_policy(self):
with mock.patch.object(common,
@ -428,7 +428,7 @@ class VolumeTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_volume_type, output['volume_type'])
self.assertDictEqual(expected_volume_type, output['volume_type'])
def test_view_builder_list(self):
view_builder = views_types.ViewBuilder()
@ -462,7 +462,7 @@ class VolumeTypesApiTest(test.TestCase):
is_public=True,
id=42 + i
)
self.assertDictMatch(expected_volume_type,
self.assertDictEqual(expected_volume_type,
output['volume_types'][i])
def test_view_builder_list_admin(self):
@ -499,5 +499,5 @@ class VolumeTypesApiTest(test.TestCase):
extra_specs={},
id=42 + i
)
self.assertDictMatch(expected_volume_type,
self.assertDictEqual(expected_volume_type,
output['volume_types'][i])

View File

@ -349,7 +349,7 @@ class GroupTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_group_type, output['group_type'])
self.assertDictEqual(expected_group_type, output['group_type'])
def test_view_builder_show_admin(self):
view_builder = views_types.ViewBuilder()
@ -379,7 +379,7 @@ class GroupTypesApiTest(test.TestCase):
group_specs={},
id=42,
)
self.assertDictMatch(expected_group_type, output['group_type'])
self.assertDictEqual(expected_group_type, output['group_type'])
def __test_view_builder_show_qos_specs_id_policy(self):
with mock.patch.object(common,
@ -409,7 +409,7 @@ class GroupTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_group_type, output['group_type'])
self.assertDictEqual(expected_group_type, output['group_type'])
def test_view_builder_show_group_specs_policy(self):
with mock.patch.object(common,
@ -441,7 +441,7 @@ class GroupTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_group_type, output['group_type'])
self.assertDictEqual(expected_group_type, output['group_type'])
def test_view_builder_show_pass_all_policy(self):
with mock.patch.object(common,
@ -473,7 +473,7 @@ class GroupTypesApiTest(test.TestCase):
is_public=True,
id=42,
)
self.assertDictMatch(expected_group_type, output['group_type'])
self.assertDictEqual(expected_group_type, output['group_type'])
def test_view_builder_list(self):
view_builder = views_types.ViewBuilder()
@ -507,7 +507,7 @@ class GroupTypesApiTest(test.TestCase):
is_public=True,
id=42 + i
)
self.assertDictMatch(expected_group_type,
self.assertDictEqual(expected_group_type,
output['group_types'][i])
def test_view_builder_list_admin(self):
@ -543,7 +543,7 @@ class GroupTypesApiTest(test.TestCase):
group_specs={},
id=42 + i
)
self.assertDictMatch(expected_group_type,
self.assertDictEqual(expected_group_type,
output['group_types'][i])
def test_check_policy(self):

View File

@ -132,4 +132,4 @@ class MessageApiTest(test.TestCase):
expected = {
'messages': [ex['message']]
}
self.assertDictMatch(expected, res_dict)
self.assertDictEqual(expected, res_dict)

View File

@ -87,14 +87,14 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
'name': 'test_cg',
'availability_zone': 'nova',
'tenant_id': self.context.project_id,
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'user_id': fake.USER_ID,
'consistencygroup_id': group.id
}
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[1]
self.assertEqual('consistencygroup.create.end', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
self.assertEqual(
group.id,
objects.ConsistencyGroup.get_by_id(context.get_admin_context(),
@ -108,11 +108,11 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
self.notifier.notifications)
msg = self.notifier.notifications[2]
self.assertEqual('consistencygroup.delete.start', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[3]
self.assertEqual('consistencygroup.delete.end', msg['event_type'])
expected['status'] = fields.ConsistencyGroupStatus.DELETED
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
self.assertRaises(exception.NotFound,
objects.ConsistencyGroup.get_by_id,
self.context,
@ -163,7 +163,7 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
'name': 'test_cg',
'availability_zone': 'nova',
'tenant_id': self.context.project_id,
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'user_id': fake.USER_ID,
'consistencygroup_id': group.id
}
@ -172,10 +172,10 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
self.notifier.notifications)
msg = self.notifier.notifications[6]
self.assertEqual('consistencygroup.update.start', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[8]
self.assertEqual('consistencygroup.update.end', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
cgvolumes = db.volume_get_all_by_group(self.context, group.id)
cgvol_ids = [cgvol['id'] for cgvol in cgvolumes]
# Verify volume is removed.
@ -286,7 +286,7 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
'name': 'test_cg',
'availability_zone': 'nova',
'tenant_id': self.context.project_id,
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'user_id': fake.USER_ID,
'consistencygroup_id': group2.id,
}
@ -297,10 +297,10 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
msg = self.notifier.notifications[2]
self.assertEqual('consistencygroup.create.start', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[4]
self.assertEqual('consistencygroup.create.end', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
if len(self.notifier.notifications) > 6:
self.assertFalse(self.notifier.notifications[6],
@ -319,11 +319,11 @@ class ConsistencyGroupTestCase(base.BaseVolumeTestCase):
msg = self.notifier.notifications[6]
self.assertEqual('consistencygroup.delete.start', msg['event_type'])
expected['status'] = fields.ConsistencyGroupStatus.AVAILABLE
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[8]
self.assertEqual('consistencygroup.delete.end', msg['event_type'])
expected['status'] = fields.ConsistencyGroupStatus.DELETED
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
cg2 = objects.ConsistencyGroup.get_by_id(
context.get_admin_context(read_deleted='yes'), group2.id)

View File

@ -77,7 +77,7 @@ class QualityOfServiceSpecsTableTestCase(test.TestCase):
specs_returned = db.qos_specs_get(self.ctxt, specs_id)
qos_spec['id'] = specs_id
self.assertDictMatch(qos_spec, specs_returned)
self.assertDictEqual(qos_spec, specs_returned)
def test_qos_specs_get_all(self):
qos_list = [
@ -124,7 +124,7 @@ class QualityOfServiceSpecsTableTestCase(test.TestCase):
'specs': value}
db.qos_specs_item_delete(self.ctxt, specs_id, 'foo')
specs = db.qos_specs_get(self.ctxt, specs_id)
self.assertDictMatch(expected, specs)
self.assertDictEqual(expected, specs)
def test_associate_type_with_qos(self):
self.assertRaises(exception.VolumeTypeNotFound,

View File

@ -105,15 +105,15 @@ class GroupManagerTestCase(test.TestCase):
'name': 'test_group',
'availability_zone': 'nova',
'tenant_id': self.context.project_id,
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'user_id': fake.USER_ID,
'group_id': group.id,
'group_type': fake.GROUP_TYPE_ID
}
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[1]
self.assertEqual('group.create.end', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
self.assertEqual(
group.id,
objects.Group.get_by_id(context.get_admin_context(),
@ -127,11 +127,11 @@ class GroupManagerTestCase(test.TestCase):
self.notifier.notifications)
msg = self.notifier.notifications[2]
self.assertEqual('group.delete.start', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[3]
self.assertEqual('group.delete.end', msg['event_type'])
expected['status'] = fields.GroupStatus.DELETED
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
self.assertRaises(exception.NotFound,
objects.Group.get_by_id,
self.context,
@ -188,7 +188,7 @@ class GroupManagerTestCase(test.TestCase):
'name': 'test_group',
'availability_zone': 'nova',
'tenant_id': self.context.project_id,
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'user_id': fake.USER_ID,
'group_id': group.id,
'group_type': fake.GROUP_TYPE_ID
@ -198,10 +198,10 @@ class GroupManagerTestCase(test.TestCase):
self.notifier.notifications)
msg = self.notifier.notifications[6]
self.assertEqual('group.update.start', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[8]
self.assertEqual('group.update.end', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
grpvolumes = db.volume_get_all_by_generic_group(self.context, group.id)
grpvol_ids = [grpvol['id'] for grpvol in grpvolumes]
# Verify volume is removed.
@ -312,7 +312,7 @@ class GroupManagerTestCase(test.TestCase):
'name': 'test_group',
'availability_zone': 'nova',
'tenant_id': self.context.project_id,
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'user_id': fake.USER_ID,
'group_id': group2.id,
'group_type': fake.GROUP_TYPE_ID,
@ -324,10 +324,10 @@ class GroupManagerTestCase(test.TestCase):
msg = self.notifier.notifications[2]
self.assertEqual('group.create.start', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[4]
self.assertEqual('group.create.end', msg['event_type'])
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
if len(self.notifier.notifications) > 6:
self.assertFalse(self.notifier.notifications[6],
@ -346,11 +346,11 @@ class GroupManagerTestCase(test.TestCase):
msg = self.notifier.notifications[6]
self.assertEqual('group.delete.start', msg['event_type'])
expected['status'] = fields.GroupStatus.AVAILABLE
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
msg = self.notifier.notifications[8]
self.assertEqual('group.delete.end', msg['event_type'])
expected['status'] = fields.GroupStatus.DELETED
self.assertDictMatch(expected, msg['payload'])
self.assertDictEqual(expected, msg['payload'])
grp2 = objects.Group.get_by_id(
context.get_admin_context(read_deleted='yes'), group2.id)

View File

@ -98,7 +98,7 @@ class ImageVolumeCacheTestCase(test.TestCase):
volume_ref,
entry['image_id'],
image_meta)
self.assertDictMatch(entry, found_entry)
self.assertDictEqual(entry, found_entry)
(self.mock_db.
image_volume_cache_get_and_update_last_used.assert_called_once_with)(
self.context,

View File

@ -175,10 +175,10 @@ class TestGlanceImageService(test.TestCase):
'properties': {'instance_id': '42', 'user_id': 'fake'},
'owner': None,
}
self.assertDictMatch(expected, image_meta)
self.assertDictEqual(expected, image_meta)
image_metas = self.service.detail(self.context)
self.assertDictMatch(expected, image_metas[0])
self.assertDictEqual(expected, image_metas[0])
def test_create_without_instance_id(self):
"""Test Creating images without instance_id.
@ -211,7 +211,7 @@ class TestGlanceImageService(test.TestCase):
'owner': None,
}
actual = self.service.show(self.context, image_id)
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
def test_create(self):
fixture = self._make_fixture(name='test image')
@ -303,7 +303,7 @@ class TestGlanceImageService(test.TestCase):
'owner': None,
}
self.assertDictMatch(expected, meta)
self.assertDictEqual(expected, meta)
i = i + 1
def test_detail_limit(self):
@ -360,7 +360,7 @@ class TestGlanceImageService(test.TestCase):
'deleted': None,
'owner': None,
}
self.assertDictMatch(expected, meta)
self.assertDictEqual(expected, meta)
i = i + 1
def test_detail_invalid_marker(self):
@ -421,7 +421,7 @@ class TestGlanceImageService(test.TestCase):
translate_from_glance.return_value = image_meta.copy()
ret = service.update(self.context, image_id, image_meta)
self.assertDictMatch(image_meta, ret)
self.assertDictEqual(image_meta, ret)
if ver == 2:
client.call.assert_called_once_with(
self.context, 'update', image_id, k1='v1', remove_props=['k2'])

View File

@ -96,7 +96,7 @@ class HostManagerTestCase(test.TestCase):
def test_update_service_capabilities(self, _mock_utcnow,
_mock_get_updated_pools):
service_states = self.host_manager.service_states
self.assertDictMatch({}, service_states)
self.assertDictEqual({}, service_states)
_mock_utcnow.side_effect = [31338, 31339]
_mock_get_updated_pools.return_value = []
@ -126,7 +126,7 @@ class HostManagerTestCase(test.TestCase):
expected = {'host1': host1_volume_capabs,
'host2': host2_volume_capabs,
'host3': host3_volume_capabs}
self.assertDictMatch(expected, service_states)
self.assertDictEqual(expected, service_states)
@mock.patch(
'cinder.scheduler.host_manager.HostManager.get_usage_and_notify')
@ -157,15 +157,15 @@ class HostManagerTestCase(test.TestCase):
# S0: update_service_capabilities()
self.host_manager.update_service_capabilities(service_name, 'host1',
capab1, None, None)
self.assertDictMatch(dict(dict(timestamp=31337), **capab1),
self.assertDictEqual(dict(dict(timestamp=31337), **capab1),
self.host_manager.service_states['host1'])
# S0: notify_service_capabilities()
self.host_manager.notify_service_capabilities(service_name, 'host1',
capab1)
self.assertDictMatch(dict(dict(timestamp=31337), **capab1),
self.assertDictEqual(dict(dict(timestamp=31337), **capab1),
self.host_manager.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31338), **capab1),
self.host_manager.service_states_last_update['host1'])
@ -176,7 +176,7 @@ class HostManagerTestCase(test.TestCase):
self.host_manager_1.update_service_capabilities(service_name, 'host1',
capab1, None, None)
self.assertDictMatch(dict(dict(timestamp=31339), **capab1),
self.assertDictEqual(dict(dict(timestamp=31339), **capab1),
self.host_manager_1.service_states['host1'])
@mock.patch(
@ -216,10 +216,10 @@ class HostManagerTestCase(test.TestCase):
self.host_manager.update_service_capabilities(service_name, 'host1',
capab1, None, None)
self.assertDictMatch(dict(dict(timestamp=31340), **capab1),
self.assertDictEqual(dict(dict(timestamp=31340), **capab1),
self.host_manager.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31338), **capab1),
self.host_manager.service_states_last_update['host1'])
@ -227,10 +227,10 @@ class HostManagerTestCase(test.TestCase):
self.host_manager_1.update_service_capabilities(service_name, 'host1',
capab1, None, None)
self.assertDictMatch(dict(dict(timestamp=31341), **capab1),
self.assertDictEqual(dict(dict(timestamp=31341), **capab1),
self.host_manager_1.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31339), **capab1),
self.host_manager_1.service_states_last_update['host1'])
@ -238,10 +238,10 @@ class HostManagerTestCase(test.TestCase):
self.host_manager_1.notify_service_capabilities(service_name, 'host1',
capab1)
self.assertDictMatch(dict(dict(timestamp=31341), **capab1),
self.assertDictEqual(dict(dict(timestamp=31341), **capab1),
self.host_manager_1.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
self.host_manager_1.service_states_last_update['host1'],
dict(dict(timestamp=31339), **capab1))
@ -286,11 +286,11 @@ class HostManagerTestCase(test.TestCase):
# S0: notify_service_capabilities()
self.host_manager.notify_service_capabilities(service_name, 'host1',
capab1)
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31338), **capab1),
self.host_manager.service_states_last_update['host1'])
self.assertDictMatch(dict(dict(timestamp=31340), **capab1),
self.assertDictEqual(dict(dict(timestamp=31340), **capab1),
self.host_manager.service_states['host1'])
# Don't notify capab1 to ceilometer.
@ -300,20 +300,20 @@ class HostManagerTestCase(test.TestCase):
self.host_manager.update_service_capabilities(service_name, 'host1',
capab1, None, None)
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31340), **capab1),
self.host_manager.service_states_last_update['host1'])
self.assertDictMatch(dict(dict(timestamp=31344), **capab1),
self.assertDictEqual(dict(dict(timestamp=31344), **capab1),
self.host_manager.service_states['host1'])
# S1: update_service_capabilities()
self.host_manager_1.update_service_capabilities(service_name, 'host1',
capab1, None, None)
self.assertDictMatch(dict(dict(timestamp=31345), **capab1),
self.assertDictEqual(dict(dict(timestamp=31345), **capab1),
self.host_manager_1.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31341), **capab1),
self.host_manager_1.service_states_last_update['host1'])
@ -362,20 +362,20 @@ class HostManagerTestCase(test.TestCase):
# S0: update_service_capabilities()
self.host_manager.update_service_capabilities(service_name, 'host1',
capab2, None, None)
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31340), **capab1),
self.host_manager.service_states_last_update['host1'])
self.assertDictMatch(dict(dict(timestamp=31346), **capab2),
self.assertDictEqual(dict(dict(timestamp=31346), **capab2),
self.host_manager.service_states['host1'])
# S1: notify_service_capabilities()
self.host_manager_1.notify_service_capabilities(service_name, 'host1',
capab2)
self.assertDictMatch(dict(dict(timestamp=31345), **capab1),
self.assertDictEqual(dict(dict(timestamp=31345), **capab1),
self.host_manager_1.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31347), **capab2),
self.host_manager_1.service_states_last_update['host1'])
@ -385,10 +385,10 @@ class HostManagerTestCase(test.TestCase):
# S1: update_service_capabilities()
self.host_manager_1.update_service_capabilities(service_name, 'host1',
capab2, None, None)
self.assertDictMatch(dict(dict(timestamp=31348), **capab2),
self.assertDictEqual(dict(dict(timestamp=31348), **capab2),
self.host_manager_1.service_states['host1'])
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31347), **capab2),
self.host_manager_1.service_states_last_update['host1'])
@ -446,11 +446,11 @@ class HostManagerTestCase(test.TestCase):
# S0: notify_service_capabilities()
self.host_manager.notify_service_capabilities(service_name, 'host1',
capab2)
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31349), **capab2),
self.host_manager.service_states_last_update['host1'])
self.assertDictMatch(dict(dict(timestamp=31346), **capab2),
self.assertDictEqual(dict(dict(timestamp=31346), **capab2),
self.host_manager.service_states['host1'])
# S0 notify capab2 to ceilometer.
@ -459,22 +459,22 @@ class HostManagerTestCase(test.TestCase):
# S0: update_service_capabilities()
self.host_manager.update_service_capabilities(service_name, 'host1',
capab2, None, None)
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31349), **capab2),
self.host_manager.service_states_last_update['host1'])
self.assertDictMatch(dict(dict(timestamp=31350), **capab2),
self.assertDictEqual(dict(dict(timestamp=31350), **capab2),
self.host_manager.service_states['host1'])
# S1: update_service_capabilities()
self.host_manager_1.update_service_capabilities(service_name, 'host1',
capab2, None, None)
self.assertDictMatch(
self.assertDictEqual(
dict(dict(timestamp=31348), **capab2),
self.host_manager_1.service_states_last_update['host1'])
self.assertDictMatch(dict(dict(timestamp=31351), **capab2),
self.assertDictEqual(dict(dict(timestamp=31351), **capab2),
self.host_manager_1.service_states['host1'])
@mock.patch('cinder.objects.service.Service.is_up',
@ -1182,4 +1182,4 @@ class PoolStateTestCase(test.TestCase):
self.assertEqual(512,
fake_pool.provisioned_capacity_gb)
self.assertDictMatch(volume_capability, fake_pool.capabilities)
self.assertDictEqual(volume_capability, dict(fake_pool.capabilities))

View File

@ -768,7 +768,7 @@ class DBAPIVolumeTestCase(BaseTest):
self.assertEqual(len(val1), len(val2))
val1_dict = {x.key: x.value for x in val1}
val2_dict = {x.key: x.value for x in val2}
self.assertDictMatch(val1_dict, val2_dict)
self.assertDictEqual(val1_dict, val2_dict)
else:
self.assertEqual(val1, val2)
return result

View File

@ -345,7 +345,7 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
ctxt = context.get_admin_context()
model_update = self.driver.create_consistencygroup(ctxt, CONSISTGROUP)
mock_create_group.assert_called_once_with(CONSISTGROUP)
self.assertDictMatch({'status': 'available'}, model_update)
self.assertDictEqual({'status': 'available'}, model_update)
@mock.patch.object(proxy.RESTProxy, 'destroy_group')
@mock.patch(BASE_DRIVER + ".delete_volume", autospec=True)
@ -435,7 +435,7 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
ISCSI_CONNECTOR,
FSS_HOSTS)
result = deepcopy(ISCSI_INFO)
self.assertDictMatch(result, ret)
self.assertDictEqual(result, ret)
@mock.patch.object(proxy.RESTProxy, 'initialize_connection_iscsi')
@mock.patch(ISCSI_DRIVER + "._check_multipath", autospec=True)

View File

@ -86,7 +86,7 @@ class QoSSpecsTestCase(test.TestCase):
'id': ref['id'],
'name': 'FakeName',
'specs': input}
self.assertDictMatch(expected,
self.assertDictEqual(expected,
specs_obj_dic)
# qos specs must have unique name
@ -197,7 +197,7 @@ class QoSSpecsTestCase(test.TestCase):
'id': specs['id'],
'name': specs['name'],
'specs': specs['specs']}
self.assertDictMatch(expected, specs_dic)
self.assertDictEqual(expected, specs_dic)
self.mock_object(db, 'qos_specs_item_delete', fake_db_qos_delete_key)
self.assertRaises(exception.InvalidQoSSpecs,

View File

@ -585,7 +585,7 @@ class ReduxioISCSIDriverTestCase(test.TestCase):
]
mock_run_cmd.assert_has_calls(calls)
self.assertDictMatch(
self.assertDictEqual(
ret_connection_info,
ISCSI_CONNECTION_INFO_NO_MULTIPATH
)
@ -613,7 +613,7 @@ class ReduxioISCSIDriverTestCase(test.TestCase):
]
mock_run_cmd.assert_has_calls(calls)
self.assertDictMatch(ret_connection_info, ISCSI_CONNECTION_INFO)
self.assertDictEqual(ret_connection_info, ISCSI_CONNECTION_INFO)
self.driver.rdxApi.list_hosts.return_value = [{
"iscsi_name": CONNECTOR["initiator"],
@ -625,7 +625,7 @@ class ReduxioISCSIDriverTestCase(test.TestCase):
mock_run_cmd.assert_has_calls([mock.call.driver._run_cmd(assign_cmd)])
self.assertDictMatch(ISCSI_CONNECTION_INFO, ret_connection_info)
self.assertDictEqual(ISCSI_CONNECTION_INFO, ret_connection_info)
@mock.patch.object(rdx_cli_api.ReduxioAPI, "_run_cmd")
@mock_api(False)

View File

@ -203,7 +203,7 @@ class SynoSessionTestCase(test.TestCase):
'https://127.0.0.1:5001/webapi/query.cgi',
data=data,
verify=self.ssl_verify)
self.assertDictMatch(out, result)
self.assertDictEqual(out, result)
result = self.session.query(FAKE_API)
self.assertIsNone(result)
@ -296,10 +296,10 @@ class SynoAPIRequestTestCase(test.TestCase):
])
result = self.request.request(FAKE_API, FAKE_METHOD, version)
self.assertDictMatch({'success': True}, result)
self.assertDictEqual({'success': True}, result)
result = self.request.request(FAKE_API, FAKE_METHOD, version)
self.assertDictMatch({'error': {'code': 101}, 'success': False},
self.assertDictEqual({'error': {'code': 101}, 'success': False},
result)
self.assertRaises(exception.MalformedResponse,
@ -309,7 +309,7 @@ class SynoAPIRequestTestCase(test.TestCase):
version)
result = self.request.request(FAKE_API, FAKE_METHOD, version)
self.assertDictMatch({'http_status': 500}, result)
self.assertDictEqual({'http_status': 500}, result)
@mock.patch.object(common.LOG, 'debug')
def test_request_auth_error(self, _log):
@ -435,7 +435,7 @@ class SynoCommonTestCase(test.TestCase):
'get',
mock.ANY,
volume_path='/' + POOL_NAME))
self.assertDictMatch(POOL_INFO, result)
self.assertDictEqual(POOL_INFO, result)
del out['data']['volume']
self.assertRaises(exception.MalformedResponse,
@ -527,7 +527,7 @@ class SynoCommonTestCase(test.TestCase):
mock.ANY,
uuid=VOLUME['name'],
additional=['is_mapped']))
self.assertDictMatch(LUN_INFO, result)
self.assertDictEqual(LUN_INFO, result)
del out['data']['lun']
self.assertRaises(exception.MalformedResponse,
@ -617,7 +617,7 @@ class SynoCommonTestCase(test.TestCase):
mock.ANY,
snapshot_uuid=DS_SNAPSHOT_UUID,
additional=['status']))
self.assertDictMatch(SNAPSHOT_INFO, result)
self.assertDictEqual(SNAPSHOT_INFO, result)
del out['data']['snapshot']
self.assertRaises(exception.MalformedResponse,
@ -1160,7 +1160,7 @@ class SynoCommonTestCase(test.TestCase):
version,
param1='value1',
param2='value2')
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
self.assertRaises(exception.SynoAPIHTTPError,
self.common.exec_webapi,
@ -1248,7 +1248,7 @@ class SynoCommonTestCase(test.TestCase):
result = self.common.update_volume_stats()
self.assertDictMatch(data, result)
self.assertDictEqual(data, result)
def test_create_volume(self):
out = {
@ -1390,7 +1390,7 @@ class SynoCommonTestCase(test.TestCase):
self.common._modify_lun_name.assert_called_with(NEW_VOLUME['name'],
VOLUME['name'])
self.assertDictMatch(expected, result)
self.assertDictEqual(expected, result)
self.assertRaises(exception.VolumeMigrationFailed,
self.common.update_migrated_volume,
@ -1426,7 +1426,7 @@ class SynoCommonTestCase(test.TestCase):
taken_by='Cinder',
description='(Cinder) ' +
SNAPSHOT['id']))
self.assertDictMatch(metadata, result)
self.assertDictEqual(metadata, result)
self.assertRaises(exception.VolumeDriverException,
self.common.create_snapshot,
@ -1571,7 +1571,7 @@ class SynoCommonTestCase(test.TestCase):
self.conf.safe_get = mock.Mock(return_value=[])
result = self.common.get_iscsi_properties(volume)
self.assertDictMatch(iscsi_properties, result)
self.assertDictEqual(iscsi_properties, result)
volume['provider_location'] = ''
self.assertRaises(exception.InvalidParameterValue,
@ -1600,7 +1600,7 @@ class SynoCommonTestCase(test.TestCase):
self.conf.safe_get = mock.Mock(return_value=['10.0.0.2', '10.0.0.3'])
result = self.common.get_iscsi_properties(volume)
self.assertDictMatch(iscsi_properties, result)
self.assertDictEqual(iscsi_properties, result)
volume['provider_location'] = ''
self.assertRaises(exception.InvalidParameterValue,
@ -1622,15 +1622,15 @@ class SynoCommonTestCase(test.TestCase):
volume['provider_auth'] = 'abcde'
result = self.common.get_iscsi_properties(volume)
self.assertDictMatch(iscsi_properties, result)
self.assertDictEqual(iscsi_properties, result)
volume['provider_auth'] = ''
result = self.common.get_iscsi_properties(volume)
self.assertDictMatch(iscsi_properties, result)
self.assertDictEqual(iscsi_properties, result)
del volume['provider_auth']
result = self.common.get_iscsi_properties(volume)
self.assertDictMatch(iscsi_properties, result)
self.assertDictEqual(iscsi_properties, result)
def test_create_iscsi_export(self):
self.common._target_create = (

View File

@ -190,7 +190,7 @@ class SynoISCSIDriverTestCase(test.TestCase):
result = self.driver.create_snapshot(SNAPSHOT)
self.driver.common.create_snapshot.assert_called_with(SNAPSHOT)
self.assertDictMatch(SNAPSHOT_METADATA, result)
self.assertDictEqual(SNAPSHOT_METADATA, result)
def test_delete_snapshot(self):
self.driver.common.delete_snapshot = mock.Mock()
@ -206,12 +206,12 @@ class SynoISCSIDriverTestCase(test.TestCase):
result = self.driver.get_volume_stats(True)
self.driver.common.update_volume_stats.assert_called_with()
self.assertDictMatch(self.driver.stats, result)
self.assertEqual(self.driver.stats, result)
result = self.driver.get_volume_stats(False)
self.driver.common.update_volume_stats.assert_called_with()
self.assertDictMatch(self.driver.stats, result)
self.assertEqual(self.driver.stats, result)
def test_get_volume_stats_error(self):
self.driver.common.update_volume_stats = (
@ -343,7 +343,7 @@ class SynoISCSIDriverTestCase(test.TestCase):
self.driver.common.get_iscsi_properties.assert_called_with(VOLUME)
self.conf.safe_get.assert_called_with('iscsi_protocol')
self.assertEqual('iscsi', result['driver_volume_type'])
self.assertDictMatch(iscsi_properties, result['data'])
self.assertDictEqual(iscsi_properties, result['data'])
def test_initialize_connection_error(self):
self.driver.common.get_iscsi_properties = (

View File

@ -2140,13 +2140,13 @@ class VolumeTestCase(base.BaseVolumeTestCase):
# be consumed by front-end or both front-end and back-end
conn_info = self.volume.initialize_connection(
self.context, fake_volume_obj, connector,)
self.assertDictMatch(qos_specs_expected,
self.assertDictEqual(qos_specs_expected,
conn_info['data']['qos_specs'])
qos_values.update({'consumer': 'both'})
conn_info = self.volume.initialize_connection(
self.context, fake_volume_obj, connector)
self.assertDictMatch(qos_specs_expected,
self.assertDictEqual(qos_specs_expected,
conn_info['data']['qos_specs'])
# initialize_connection() skips qos_specs that is designated to be
# consumed by back-end only
@ -2204,7 +2204,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
volume = volume if volume_object else vol
@ -2253,7 +2253,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
@ -2287,7 +2287,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:02'}
conn_info = self.volume.initialize_connection(self.context,
@ -2381,7 +2381,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
attachment2 = self.volume.attach_volume(self.context, volume_id,
instance_uuid_2, None,
mountpoint, 'ro')
@ -2450,7 +2450,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2522,7 +2522,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2573,7 +2573,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2628,7 +2628,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
@ -2676,7 +2676,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2740,7 +2740,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2788,7 +2788,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2850,7 +2850,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2885,7 +2885,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
conn_info = self.volume.initialize_connection(self.context,
volume, connector)
@ -2947,7 +2947,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
db.volume_update(self.context, volume_id, {'status': 'available'})
self.assertRaises(exception.InvalidVolumeAttachMode,
@ -2971,7 +2971,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
ret = {}
for item in admin_metadata:
ret.update({item['key']: item['value']})
self.assertDictMatch(expected, ret)
self.assertDictEqual(expected, ret)
def test_run_api_attach_detach_volume_with_wrong_attach_mode(self):
# Not allow using 'read-write' mode attach readonly volume
@ -3455,7 +3455,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
self.assertEqual(len(vol_glance_meta), len(snap_glance_meta))
vol_glance_dict = {x.key: x.value for x in vol_glance_meta}
snap_glance_dict = {x.key: x.value for x in snap_glance_meta}
self.assertDictMatch(vol_glance_dict, snap_glance_dict)
self.assertDictEqual(vol_glance_dict, snap_glance_dict)
# ensure that snapshot's status is changed to 'available'
self.assertEqual(fields.SnapshotStatus.AVAILABLE, snap.status)

View File

@ -363,7 +363,7 @@ class VolumeTypeTestCase(test.TestCase):
'k2': 'v2',
'k3': 'v3'}}}
res = volume_types.get_volume_type_qos_specs(type_ref['id'])
self.assertDictMatch(expected, res)
self.assertDictEqual(expected, res)
def test_volume_types_diff(self):
# type_ref 1 and 2 have the same extra_specs, while 3 has different

View File

@ -158,13 +158,13 @@ class NotifyUsageTestCase(test.TestCase):
'volume_size': 1,
'snapshot_id': fake.SNAPSHOT_ID,
'display_name': '11',
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'status': fields.SnapshotStatus.ERROR,
'deleted': '',
'metadata': six.text_type({'fake_snap_meta_key':
u'fake_snap_meta_value'}),
}
self.assertDictMatch(expected_snapshot, usage_info)
self.assertDictEqual(expected_snapshot, usage_info)
@mock.patch('cinder.objects.Volume.get_by_id')
def test_usage_from_deleted_snapshot(self, volume_get_by_id):
@ -204,13 +204,13 @@ class NotifyUsageTestCase(test.TestCase):
'volume_size': 1,
'snapshot_id': fake.SNAPSHOT_ID,
'display_name': '11',
'created_at': 'DONTCARE',
'created_at': mock.ANY,
'status': fields.SnapshotStatus.ERROR,
'deleted': '',
'metadata': six.text_type({'fake_snap_meta_key':
u'fake_snap_meta_value'}),
}
self.assertDictMatch(expected_snapshot, usage_info)
self.assertDictEqual(expected_snapshot, usage_info)
@mock.patch('cinder.db.volume_glance_metadata_get')
@mock.patch('cinder.db.volume_attachment_get_all_by_volume_id')
@ -372,7 +372,7 @@ class NotifyUsageTestCase(test.TestCase):
six.text_type(expected_backup['created_at']) + '+00:00')
usage_info = volume_utils._usage_from_backup(backup_obj)
self.assertDictMatch(expected_backup, usage_info)
self.assertDictEqual(expected_backup, usage_info)
class LVMVolumeDriverTestCase(test.TestCase):

View File

@ -4667,7 +4667,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
expected +
self.standard_logout)
self.assertDictMatch(expected_properties, result)
self.assertDictEqual(expected_properties, result)
@mock.patch('cinder.zonemanager.utils.create_lookup_service')
def test_initialize_connection_with_lookup_single_nsp(self, mock_lookup):
@ -4761,7 +4761,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
expected +
self.standard_logout)
self.assertDictMatch(expected_properties, result)
self.assertDictEqual(expected_properties, result)
def test_initialize_connection_encrypted(self):
# setup_mock_client drive with default configuration
@ -4861,7 +4861,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
expected +
self.standard_logout)
self.assertDictMatch(expected_properties, result)
self.assertDictEqual(expected_properties, result)
def test_terminate_connection(self):
# setup_mock_client drive with default configuration
@ -5787,7 +5787,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
expected +
self.standard_logout)
self.assertDictMatch(self.properties, result)
self.assertDictEqual(self.properties, result)
def test_initialize_connection_multipath(self):
# setup_mock_client drive with default configuration
@ -5852,7 +5852,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
expected +
self.standard_logout)
self.assertDictMatch(self.multipath_properties, result)
self.assertDictEqual(self.multipath_properties, result)
def test_initialize_connection_multipath_existing_nsp(self):
# setup_mock_client drive with default configuration
@ -5905,7 +5905,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
expected +
self.standard_logout)
self.assertDictMatch(self.multipath_properties, result)
self.assertDictEqual(self.multipath_properties, result)
def test_initialize_connection_encrypted(self):
# setup_mock_client drive with default configuration
@ -5960,7 +5960,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
expected_properties = self.properties
expected_properties['data']['encrypted'] = True
self.assertDictMatch(self.properties, result)
self.assertDictEqual(self.properties, result)
def test_terminate_connection_for_clear_chap_creds_not_found(self):
# setup_mock_client drive with default configuration
@ -7304,7 +7304,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
model_with_remote_name = self.driver._do_export(common, volume)
mock_client.assert_has_calls(expected)
self.assertDictMatch(expected_model, model_with_remote_name)
self.assertDictEqual(expected_model, model_with_remote_name)
# vlun does not has remoteName
mock_client.getHostVLUNs.return_value = [
@ -7313,7 +7313,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
model_without_remote_name = self.driver._do_export(common, volume)
mock_client.assert_has_calls(expected)
self.assertDictMatch(expected_model, model_without_remote_name)
self.assertDictEqual(expected_model, model_without_remote_name)
@mock.patch('cinder.volume.utils.generate_password')
def test_create_export(self, mock_utils):
@ -7351,7 +7351,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
mock_create_client.return_value = mock_client
model = self.driver.create_export(None, volume, None)
mock_client.assert_has_calls(expected)
self.assertDictMatch(expected_model, model)
self.assertDictEqual(expected_model, model)
def test_initialize_iscsi_ports_with_iscsi_ip_and_port(self):
# setup_mock_client drive with default configuration

View File

@ -1213,7 +1213,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
# used as optional configuration values by the LeftHand backend
optional = self.driver._map_extra_specs(extra_specs)
self.assertDictMatch({'isThinProvisioned': False}, optional)
self.assertDictEqual({'isThinProvisioned': False}, optional)
@mock.patch.object(volume_types, 'get_volume_type')
def test_extra_spec_mapping_invalid_value(self, _mock_get_volume_type):
@ -1244,7 +1244,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
# {'hpelh:ao': 'true'} should map to
# {'isAdaptiveOptimizationEnabled': True}
# without hpelh:data_pl since r-07 is an invalid value
self.assertDictMatch({'isAdaptiveOptimizationEnabled': True}, optional)
self.assertDictEqual({'isAdaptiveOptimizationEnabled': True}, optional)
def test_retype_with_no_LH_extra_specs(self):
# setup driver with default configuration

View File

@ -2161,9 +2161,9 @@ class InfortrendCLITestCase(test.TestCase):
if isinstance(out, list):
for i in range(len(test_data[1])):
self.assertDictMatch(test_data[1][i], out[i])
self.assertDictEqual(test_data[1][i], out[i])
else:
self.assertDictMatch(test_data[1], out)
self.assertDictEqual(test_data[1], out)
@mock.patch.object(cli.LOG, 'debug', mock.Mock())
def test_cli_all_command_execute(self):

View File

@ -123,8 +123,8 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
self.driver._init_map_info(True)
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
def test_normal_channel_with_r_model(self):
@ -143,8 +143,8 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
self.driver._init_map_info(True)
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_initialize_connection(self):
@ -163,7 +163,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(self.cli_data.test_fc_properties, properties)
self.assertDictEqual(self.cli_data.test_fc_properties, properties)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_initialize_connection_specific_channel(self):
@ -184,7 +184,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_properties_with_specific_channel, properties)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -218,7 +218,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_properties_with_specific_channel, properties)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -238,7 +238,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_properties_multipath_r_model, properties)
def test_initialize_connection_with_get_wwn_fail(self):
@ -304,7 +304,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_properties_zoning, properties)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -353,7 +353,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_properties_zoning_r_model, properties)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -403,7 +403,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_properties_zoning_r_model, properties)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -466,7 +466,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_fc_terminate_conn_info, conn_info)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -602,8 +602,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.driver._init_map_info()
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
def test_normal_channel_with_multipath(self):
@ -622,8 +622,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.driver._init_map_info(multipath=True)
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
def test_specific_channel(self):
@ -645,8 +645,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.driver._init_map_info()
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
def test_update_mcs_dict(self):
@ -664,7 +664,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.driver._init_map_info()
self.assertDictMatch(test_mcs_dict, self.driver.mcs_dict)
self.assertDictEqual(test_mcs_dict, self.driver.mcs_dict)
def test_mapping_info_with_mcs(self):
@ -692,7 +692,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
map_chl, map_lun, mcs_id = self.driver._get_mapping_info_with_mcs()
self.assertDictMatch(test_map_chl, map_chl)
self.assertDictEqual(test_map_chl, map_chl)
self.assertEqual(test_map_lun, map_lun)
self.assertEqual(test_mcs_id, mcs_id)
@ -728,7 +728,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
map_chl, map_lun, mcs_id = self.driver._get_mapping_info_with_mcs()
self.assertDictMatch(test_map_chl, map_chl)
self.assertDictEqual(test_map_chl, map_chl)
self.assertEqual(test_map_lun, map_lun)
self.assertEqual(test_mcs_id, mcs_id)
@ -752,8 +752,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.driver._init_map_info(multipath=True)
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
def test_specific_channel_with_multipath_r_model(self):
@ -776,8 +776,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
self.driver._init_map_info(multipath=True)
self.assertDictMatch(test_map_dict, self.driver.map_dict)
self.assertDictMatch(test_target_dict, self.driver.target_dict)
self.assertDictEqual(test_map_dict, self.driver.map_dict)
self.assertDictEqual(test_target_dict, self.driver.target_dict)
@mock.patch.object(common_cli.LOG, 'info')
def test_create_volume(self, log_info):
@ -799,7 +799,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
model_update = self.driver.create_volume(test_volume)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
self.assertEqual(1, log_info.call_count)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -974,7 +974,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
model_update = self.driver.create_cloned_volume(
test_dst_volume, test_src_volume)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
self.assertEqual(1, log_info.call_count)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -1009,7 +1009,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
model_update = self.driver.create_export(None, test_volume)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_get_volume_stats(self):
@ -1026,7 +1026,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
volume_states = self.driver.get_volume_stats(True)
self.assertDictMatch(test_volume_states, volume_states)
self.assertDictEqual(test_volume_states, volume_states)
def test_get_volume_stats_fail(self):
@ -1208,7 +1208,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
model_update = self.driver.create_volume_from_snapshot(
test_dst_volume, test_snapshot)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
self.assertEqual(1, log_info.call_count)
@mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall',
@ -1247,7 +1247,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
model_update = self.driver.create_volume_from_snapshot(
test_dst_volume, test_snapshot)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
self.assertEqual(1, log_info.call_count)
def test_create_volume_from_snapshot_without_provider_location(
@ -1291,7 +1291,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(test_iscsi_properties, properties)
self.assertDictEqual(test_iscsi_properties, properties)
expect_cli_cmd = [
mock.call('CreateMap', 'part', test_partition_id, '2', '0', '0',
@ -1328,7 +1328,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(test_iscsi_properties, properties)
self.assertDictEqual(test_iscsi_properties, properties)
expect_cli_cmd = [
mock.call('CreateIQN', test_initiator, test_initiator[-16:]),
@ -1362,7 +1362,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(
self.assertDictEqual(
self.cli_data.test_iscsi_properties_empty_map, properties)
def test_initialize_connection_with_create_map_fail(self):
@ -1434,7 +1434,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
properties = self.driver.initialize_connection(
test_volume, test_connector)
self.assertDictMatch(test_iscsi_properties, properties)
self.assertDictEqual(test_iscsi_properties, properties)
expect_cli_cmd = [
mock.call('CreateMap', 'part', test_partition_id, '1', '0', '2',
@ -1592,7 +1592,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertTrue(rc)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
@mock.patch.object(common_cli.LOG, 'warning')
def test_migrate_volume_with_invalid_storage(self, log_warning):
@ -1837,7 +1837,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertEqual(1, log_info.call_count)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
def test_manage_existing_rename_fail(self):
@ -1907,7 +1907,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertEqual(1, log_info.call_count)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
@mock.patch.object(common_cli.LOG, 'info')
def test_unmanage(self, log_info):
@ -2029,7 +2029,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertTrue(rc)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
@mock.patch.object(common_cli.LOG, 'debug', mock.Mock())
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
@ -2057,7 +2057,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass):
'name=%s' % src_volume['id'].replace('-', '')),
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(test_model_update, model_update)
self.assertDictEqual(test_model_update, model_update)
@mock.patch.object(common_cli.LOG, 'debug', mock.Mock())
def test_update_migrated_volume_rename_fail(self):

View File

@ -135,7 +135,7 @@ class NetAppCDOTDataMotionMixinTestCase(test.TestCase):
actual_stats = self.dm_mixin.get_replication_backend_stats(self.config)
self.assertDictMatch(expected_stats, actual_stats)
self.assertDictEqual(expected_stats, actual_stats)
@ddt.data(None, [],
[{'backend_id': 'replication_backend_2', 'aggr2': 'aggr20'}])
@ -165,7 +165,7 @@ class NetAppCDOTDataMotionMixinTestCase(test.TestCase):
aggr_map = self.dm_mixin._get_replication_aggregate_map(
self.src_backend, 'replication_backend_1')
self.assertDictMatch({'aggr1': 'aggr10'}, aggr_map)
self.assertDictEqual({'aggr1': 'aggr10'}, aggr_map)
@ddt.data(True, False)
def test_create_snapmirror_dest_flexvol_exists(self, dest_exists):

View File

@ -682,7 +682,7 @@ class NetAppEseriesClientDriverTestCase(test.TestCase):
**{'object-id':
fake_volume['id']}
)
self.assertDictMatch(expected_volume, updated_volume)
self.assertDictEqual(expected_volume, updated_volume)
def test_get_pool_operation_progress(self):
fake_pool = copy.deepcopy(eseries_fake.STORAGE_POOL)

View File

@ -297,7 +297,7 @@ class NetAppEseriesLibraryTestCase(test.TestCase):
result = self.library._get_volume(fake_volume['id'])
self.assertEqual(1, self.library._client.list_volume.call_count)
self.assertDictMatch(volume, result)
self.assertDictEqual(volume, result)
def test_get_volume_bad_input(self):
volume = copy.deepcopy(eseries_fake.VOLUME)
@ -383,7 +383,7 @@ class NetAppEseriesLibraryTestCase(test.TestCase):
'netapp_disk_type': disk_type
}
actual = self.library._ssc_stats[poolId]
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
@ddt.data(('FC', True), ('iSCSI', False))
@ddt.unpack

View File

@ -446,10 +446,10 @@ class HGSTTestCase(test.TestCase):
'user': 'kane', 'net': 'net1',
'storageserver': 'stor1:gbd0,stor2:gbd0,',
'size': '12'}
self.assertDictMatch(expected, self.created)
self.assertDictEqual(expected, self.created)
# Check the returned provider, note that provider_id is hashed
expected_pid = {'provider_id': 'volume10'}
self.assertDictMatch(expected_pid, ret)
self.assertDictEqual(expected_pid, ret)
@mock.patch('socket.gethostbyname', return_value='123.123.123.123')
def test_create_volume_name_creation_fail(self, mock_ghn):
@ -483,10 +483,10 @@ class HGSTTestCase(test.TestCase):
'user': 'kane', 'net': 'net1',
'storageserver': 'stor1:gbd0,stor2:gbd0,',
'size': '12'}
self.assertDictMatch(expected, self.created)
self.assertDictEqual(expected, self.created)
# Check the returned provider
expected_pid = {'provider_id': 'snap10'}
self.assertDictMatch(expected_pid, ret)
self.assertDictEqual(expected_pid, ret)
@mock.patch('socket.gethostbyname', return_value='123.123.123.123')
def test_create_cloned_volume(self, mock_ghn):
@ -509,10 +509,10 @@ class HGSTTestCase(test.TestCase):
'user': 'kane', 'net': 'net1',
'storageserver': 'stor1:gbd0,stor2:gbd0,',
'size': '12'}
self.assertDictMatch(expected, self.created)
self.assertDictEqual(expected, self.created)
# Check the returned provider
expected_pid = {'provider_id': 'clone1'}
self.assertDictMatch(expected_pid, pid)
self.assertDictEqual(expected_pid, pid)
@mock.patch('socket.gethostbyname', return_value='123.123.123.123')
def test_add_cinder_apphosts_fails(self, mock_ghn):
@ -550,10 +550,10 @@ class HGSTTestCase(test.TestCase):
'user': 'kane', 'net': 'net1',
'storageserver': 'stor1:gbd0,stor2:gbd0,',
'size': '12'}
self.assertDictMatch(expected, self.created)
self.assertDictEqual(expected, self.created)
# Check the returned provider
expected_pid = {'provider_id': 'volume2'}
self.assertDictMatch(expected_pid, pid)
self.assertDictEqual(expected_pid, pid)
@mock.patch('socket.gethostbyname', return_value='123.123.123.123')
def test_create_volume_blocked(self, mock_ghn):
@ -577,10 +577,10 @@ class HGSTTestCase(test.TestCase):
'user': 'kane', 'net': 'net1',
'storageserver': 'stor1:gbd0,stor2:gbd0,',
'size': '12'}
self.assertDictMatch(expected, self.created)
self.assertDictEqual(expected, self.created)
# Check the returned provider
expected_pid = {'provider_id': 'volume10'}
self.assertDictMatch(expected_pid, ret)
self.assertDictEqual(expected_pid, ret)
self.assertTrue(self._request_cancel)
@mock.patch('socket.gethostbyname', return_value='123.123.123.123')
@ -615,7 +615,7 @@ class HGSTTestCase(test.TestCase):
'provider_id': 'volume10'}
self.driver.delete_volume(volume)
expected = {'name': 'volume10'}
self.assertDictMatch(expected, self.deleted)
self.assertDictEqual(expected, self.deleted)
def test_delete_volume_failure_modes(self):
"""Test cases where space-delete fails, but OS delete is still OK."""
@ -647,7 +647,7 @@ class HGSTTestCase(test.TestCase):
'provider_id': 'snap10'}
self.driver.delete_snapshot(snapshot)
expected = {'name': 'snap10'}
self.assertDictMatch(expected, self.deleted)
self.assertDictEqual(expected, self.deleted)
def test_extend_volume(self):
"""Test extending a volume, check the size in GB vs. GiB."""
@ -664,7 +664,7 @@ class HGSTTestCase(test.TestCase):
self.driver.extend_volume(volume, 12)
expected = {'name': 'volume10', 'size': '2',
'storageserver': 'stor1:gbd0,stor2:gbd0,'}
self.assertDictMatch(expected, self.extended)
self.assertDictEqual(expected, self.extended)
def test_extend_volume_noextend(self):
"""Test extending a volume where Space does not need to be enlarged.
@ -688,7 +688,7 @@ class HGSTTestCase(test.TestCase):
self.driver.extend_volume(volume, 10)
expected = {'name': '', 'size': '0',
'storageserver': ''}
self.assertDictMatch(expected, self.extended)
self.assertDictEqual(expected, self.extended)
def test_space_list_fails(self):
"""Test exception is thrown when we can't call space-list."""
@ -735,7 +735,7 @@ class HGSTTestCase(test.TestCase):
volume = {'name': '123', 'provider_id': 'spacey'}
conn = self.driver.initialize_connection(volume, None)
expected = {'name': 'spacey', 'noremovehost': 'thisserver'}
self.assertDictMatch(expected, conn['data'])
self.assertDictEqual(expected, conn['data'])
# Below are some command outputs we emulate
IP_OUTPUT = """

View File

@ -684,7 +684,7 @@ class TestProphetStorDPLDriver(test.TestCase):
self.DPL_MOCK.create_vg.assert_called_once_with(
self._conver_uuid2hex(DATA_IN_GROUP['id']), DATA_IN_GROUP['name'],
DATA_IN_GROUP['description'])
self.assertDictMatch({'status': (
self.assertDictEqual({'status': (
fields.ConsistencyGroupStatus.AVAILABLE)}, model_update)
def test_delete_consistency_group(self):
@ -698,7 +698,7 @@ class TestProphetStorDPLDriver(test.TestCase):
self._conver_uuid2hex(DATA_IN_GROUP['id']))
self.DPL_MOCK.delete_vdev.assert_called_once_with(
self._conver_uuid2hex((DATA_IN_VOLUME_VG['id'])))
self.assertDictMatch({'status': (
self.assertDictEqual({'status': (
fields.ConsistencyGroupStatus.DELETED)}, model_update)
def test_update_consistencygroup(self):
@ -718,7 +718,7 @@ class TestProphetStorDPLDriver(test.TestCase):
self.DPL_MOCK.leave_vg.assert_called_once_with(
self._conver_uuid2hex(remove_vol['id']),
self._conver_uuid2hex(DATA_IN_GROUP['id']))
self.assertDictMatch({'status': (
self.assertDictEqual({'status': (
fields.ConsistencyGroupStatus.AVAILABLE)}, model_update)
def test_update_consistencygroup_exception_join(self):
@ -753,7 +753,7 @@ class TestProphetStorDPLDriver(test.TestCase):
self.DPL_MOCK.create_vdev_snapshot.return_value = DATA_OUTPUT
model_update, snapshots = self.dpldriver.create_cgsnapshot(
self.context, snapshot_obj, [])
self.assertDictMatch({'status': 'available'}, model_update)
self.assertDictEqual({'status': 'available'}, model_update)
@mock.patch('cinder.objects.snapshot.SnapshotList.get_all_for_cgsnapshot')
def test_delete_consistency_group_snapshot(self, get_all_for_cgsnapshot):
@ -768,4 +768,4 @@ class TestProphetStorDPLDriver(test.TestCase):
self._conver_uuid2hex(DATA_IN_CG_SNAPSHOT['consistencygroup_id']),
self._conver_uuid2hex(DATA_IN_CG_SNAPSHOT['id']),
True)
self.assertDictMatch({'status': 'deleted'}, model_update)
self.assertDictEqual({'status': 'deleted'}, model_update)

View File

@ -2197,7 +2197,7 @@ class PureISCSIDriverTestCase(PureDriverTestCase):
real_result = self.driver.initialize_connection(VOLUME,
ISCSI_CONNECTOR)
self.assertDictMatch(result, real_result)
self.assertDictEqual(result, real_result)
mock_get_iscsi_ports.assert_called_with()
mock_connection.assert_called_with(VOLUME, ISCSI_CONNECTOR)
self.assert_error_propagates([mock_get_iscsi_ports, mock_connection],
@ -2229,7 +2229,7 @@ class PureISCSIDriverTestCase(PureDriverTestCase):
real_result = self.driver.initialize_connection(VOLUME,
ISCSI_CONNECTOR)
mock_connection.assert_called_with(VOLUME, ISCSI_CONNECTOR)
self.assertDictMatch(result, real_result)
self.assertDictEqual(result, real_result)
self.assert_error_propagates([mock_get_iscsi_ports, mock_connection],
self.driver.initialize_connection,
@ -2253,7 +2253,7 @@ class PureISCSIDriverTestCase(PureDriverTestCase):
real_result = self.driver.initialize_connection(VOLUME,
multipath_connector)
self.assertDictMatch(result, real_result)
self.assertDictEqual(result, real_result)
mock_get_iscsi_ports.assert_called_with()
mock_connection.assert_called_with(VOLUME, multipath_connector)
@ -2327,7 +2327,7 @@ class PureISCSIDriverTestCase(PureDriverTestCase):
self.driver._connect(VOLUME, ISCSI_CONNECTOR)
result["auth_username"] = chap_user
result["auth_password"] = chap_password
self.assertDictMatch(result, real_result)
self.assertDictEqual(result, real_result)
self.array.set_host.assert_called_with(PURE_HOST_NAME,
host_user=chap_user,
host_password=chap_password)
@ -2339,7 +2339,7 @@ class PureISCSIDriverTestCase(PureDriverTestCase):
result["auth_username"] = chap_user
result["auth_password"] = chap_password
self.assertDictMatch(result, real_result)
self.assertDictEqual(result, real_result)
self.array.set_host.assert_called_with(PURE_HOST_NAME,
host_user=chap_user,
host_password=chap_password)
@ -2517,7 +2517,7 @@ class PureFCDriverTestCase(PureDriverTestCase):
}
self.array.list_ports.return_value = FC_PORTS
actual_result = self.driver.initialize_connection(VOLUME, FC_CONNECTOR)
self.assertDictMatch(FC_CONNECTION_INFO, actual_result)
self.assertDictEqual(FC_CONNECTION_INFO, actual_result)
@mock.patch(FC_DRIVER_OBJ + "._get_host", autospec=True)
@mock.patch(FC_DRIVER_OBJ + "._generate_purity_host_name", spec=True)
@ -2707,13 +2707,13 @@ class PureVolumeUpdateStatsTestCase(PureBaseSharedDriverTestCase):
}
real_result = self.driver.get_volume_stats(refresh=True)
self.assertDictMatch(expected_result, real_result)
self.assertDictEqual(expected_result, real_result)
# Make sure when refresh=False we are using cached values and not
# sending additional requests to the array.
self.array.reset_mock()
real_result = self.driver.get_volume_stats(refresh=False)
self.assertDictMatch(expected_result, real_result)
self.assertDictEqual(expected_result, real_result)
self.assertFalse(self.array.get.called)
self.assertFalse(self.array.list_volumes.called)
self.assertFalse(self.array.list_hosts.called)

View File

@ -1111,7 +1111,7 @@ class RBDTestCase(test.TestCase):
actual = self.driver.get_volume_stats(True)
client.cluster.mon_command.assert_called_once_with(
'{"prefix":"df", "format":"json"}', '')
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
@common_mocks
def test_update_volume_stats_error(self):
@ -1141,7 +1141,7 @@ class RBDTestCase(test.TestCase):
actual = self.driver.get_volume_stats(True)
client.cluster.mon_command.assert_called_once_with(
'{"prefix":"df", "format":"json"}', '')
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
@common_mocks
def test_get_mon_addrs(self):
@ -1176,7 +1176,7 @@ class RBDTestCase(test.TestCase):
}
}
actual = self.driver.initialize_connection(self.volume_a, None)
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
self.assertTrue(mock_get_mon_addrs.called)
@ddt.data({'rbd_chunk_size': 1, 'order': 20},

View File

@ -1177,7 +1177,7 @@ class SheepdogDriverTestCase(test.TestCase):
reserved_percentage=0,
QoS_support=False)
actual = self.driver.get_volume_stats(True)
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
@mock.patch.object(sheepdog.SheepdogClient, '_run_dog')
def test_copy_image_to_volume(self, fake_run_dog):
@ -1384,7 +1384,7 @@ class SheepdogDriverTestCase(test.TestCase):
}
}
actual = self.driver.initialize_connection(fake_volume, None)
self.assertDictMatch(expected, actual)
self.assertDictEqual(expected, actual)
@mock.patch.object(sheepdog.SheepdogClient, 'resize')
@mock.patch.object(sheepdog, 'LOG')

View File

@ -891,7 +891,7 @@ class XIOISEDriverTestCase(object):
'storage_protocol': protocol}
act_result = self.driver.get_volume_stats(True)
self.assertDictMatch(exp_result, act_result)
self.assertDictEqual(exp_result, act_result)
def test_get_volume_stats_ssl(self, mock_req):
self.configuration.driver_use_ssl = True
@ -930,7 +930,7 @@ class XIOISEDriverTestCase(object):
exp_result = {}
exp_result = {"provider_auth": ""}
act_result = self.driver.create_volume(VOLUME1)
self.assertDictMatch(exp_result, act_result)
self.assertDictEqual(exp_result, act_result)
elif self.configuration.ise_protocol == 'fibre_channel':
mock_req.side_effect = iter([ISE_GET_QUERY_RESP,
ISE_CREATE_VOLUME_RESP,
@ -959,7 +959,7 @@ class XIOISEDriverTestCase(object):
exp_result = {}
exp_result = {"provider_auth": "CHAP abc abc"}
act_result = self.driver.create_volume(VOLUME1)
self.assertDictMatch(exp_result, act_result)
self.assertDictEqual(exp_result, act_result)
elif self.configuration.ise_protocol == 'fibre_channel':
mock_req.side_effect = iter([ISE_GET_QUERY_RESP,
ISE_CREATE_VOLUME_RESP,
@ -1051,7 +1051,7 @@ class XIOISEDriverTestCase(object):
act_result =\
self.driver.initialize_connection(VOLUME1, self.connector)
self.assertDictMatch(exp_result, act_result)
self.assertDictEqual(exp_result, act_result)
def test_initialize_connection_positive_host_type(self, mock_req):
mock_req.side_effect = iter([ISE_GET_QUERY_RESP,
@ -1080,7 +1080,7 @@ class XIOISEDriverTestCase(object):
act_result =\
self.driver.initialize_connection(VOLUME1, self.connector)
self.assertDictMatch(exp_result, act_result)
self.assertDictEqual(exp_result, act_result)
def test_initialize_connection_positive_chap(self, mock_req):
mock_req.side_effect = iter([ISE_GET_QUERY_RESP,
@ -1112,7 +1112,7 @@ class XIOISEDriverTestCase(object):
act_result =\
self.driver.initialize_connection(VOLUME2, self.connector)
self.assertDictMatch(exp_result, act_result)
self.assertDictEqual(exp_result, act_result)
def test_initialize_connection_negative_no_host(self, mock_req):
mock_req.side_effect = iter([ISE_GET_QUERY_RESP,

View File

@ -1669,7 +1669,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
rp_2 = mock.Mock(value='rp-2')
self.assertEqual(dc_1, self._driver._get_dc(rp_1))
self.assertEqual(dc_2, self._driver._get_dc(rp_2))
self.assertDictMatch({'rp-1': dc_1, 'rp-2': dc_2},
self.assertDictEqual({'rp-1': dc_1, 'rp-2': dc_2},
self._driver._dc_cache)
# cache hit

View File

@ -124,7 +124,7 @@ class TestBrcdFCSanLookupService(brcd_lookup.BrcdFCSanLookupService,
get_southbound_client_mock.return_value = self.get_client("HTTPS")
device_map = self.get_device_mapping_from_network(
initiator_list, target_list)
self.assertDictMatch(_device_map_to_verify, device_map)
self.assertDictEqual(_device_map_to_verify, device_map)
class FakeClient(object):

View File

@ -80,7 +80,7 @@ class TestBrcdFCZoneClientCLI(client_cli.BrcdFCZoneClientCLI, test.TestCase):
get_switch_info_mock.return_value = cfgactvshow
active_zoneset_returned = self.get_active_zone_set()
get_switch_info_mock.assert_called_once_with(cmd_list)
self.assertDictMatch(active_zoneset, active_zoneset_returned)
self.assertDictEqual(active_zoneset, active_zoneset_returned)
@mock.patch.object(client_cli.BrcdFCZoneClientCLI, '_run_ssh')
def test_get_active_zone_set_ssh_error(self, run_ssh_mock):

View File

@ -598,7 +598,7 @@ class TestBrcdHttpFCZoneClient(client.BrcdHTTPFCZoneClient, test.TestCase):
def test_get_active_zone_set(self, connect_mock):
connect_mock.return_value = zone_info
returned_zone_map = self.get_active_zone_set()
self.assertDictMatch(active_zone_set, returned_zone_map)
self.assertDictEqual(active_zone_set, returned_zone_map)
def test_form_zone_string(self):
new_alias = {

View File

@ -54,7 +54,7 @@ class TestFCSanLookupService(san_service.FCSanLookupService, test.TestCase):
target_list = ['20240002ac000a50', '20240002ac000a40']
device_map = self.get_device_mapping_from_network(
initiator_list, target_list)
self.assertDictMatch(_device_map_to_verify, device_map)
self.assertDictEqual(_device_map_to_verify, device_map)
def test_get_device_mapping_from_network_for_invalid_config(self):
GlobalParams._is_normal_test = False

View File

@ -85,7 +85,7 @@ class TestCiscoFCSanLookupService(cisco_lookup.CiscoFCSanLookupService,
get_nameserver_info_mock.return_value = (nsshow_data)
device_map = self.get_device_mapping_from_network(
initiator_list, target_list)
self.assertDictMatch(_device_map_to_verify, device_map)
self.assertDictEqual(_device_map_to_verify, device_map)
@mock.patch.object(cisco_lookup.CiscoFCSanLookupService,
'_get_switch_info')

View File

@ -142,7 +142,7 @@ class TestCiscoFCZoneClientCLI(cli.CiscoFCZoneClientCLI, test.TestCase):
get_switch_info_mock.return_value = cfgactv
active_zoneset_returned = self.get_active_zone_set()
get_switch_info_mock.assert_called_once_with(cmd_list)
self.assertDictMatch(active_zoneset, active_zoneset_returned)
self.assertDictEqual(active_zoneset, active_zoneset_returned)
@mock.patch.object(cli.CiscoFCZoneClientCLI, '_run_ssh')
def test_get_active_zone_set_ssh_error(self, run_ssh_mock):
@ -156,7 +156,7 @@ class TestCiscoFCZoneClientCLI(cli.CiscoFCZoneClientCLI, test.TestCase):
get_zoning_status_mock.return_value = zoning_status_data_basic
zoning_status_returned = self.get_zoning_status()
get_zoning_status_mock.assert_called_once_with(cmd_list)
self.assertDictMatch(zoning_status_basic, zoning_status_returned)
self.assertDictEqual(zoning_status_basic, zoning_status_returned)
@mock.patch.object(cli.CiscoFCZoneClientCLI, '_get_switch_info')
def test_get_zoning_status_enhanced_nosess(self, get_zoning_status_mock):
@ -165,7 +165,7 @@ class TestCiscoFCZoneClientCLI(cli.CiscoFCZoneClientCLI, test.TestCase):
zoning_status_data_enhanced_nosess
zoning_status_returned = self.get_zoning_status()
get_zoning_status_mock.assert_called_once_with(cmd_list)
self.assertDictMatch(zoning_status_enhanced_nosess,
self.assertDictEqual(zoning_status_enhanced_nosess,
zoning_status_returned)
@mock.patch.object(cli.CiscoFCZoneClientCLI, '_get_switch_info')
@ -174,7 +174,7 @@ class TestCiscoFCZoneClientCLI(cli.CiscoFCZoneClientCLI, test.TestCase):
get_zoning_status_mock.return_value = zoning_status_data_enhanced_sess
zoning_status_returned = self.get_zoning_status()
get_zoning_status_mock.assert_called_once_with(cmd_list)
self.assertDictMatch(zoning_status_enhanced_sess,
self.assertDictEqual(zoning_status_enhanced_sess,
zoning_status_returned)
@mock.patch.object(cli.CiscoFCZoneClientCLI, '_get_switch_info')

View File

@ -55,7 +55,7 @@ class TestFCSanLookupService(san_service.FCSanLookupService, test.TestCase):
target_list = ['20240002ac000a50', '20240002ac000a40']
device_map = self.get_device_mapping_from_network(
initiator_list, target_list)
self.assertDictMatch(_device_map_to_verify, device_map)
self.assertDictEqual(_device_map_to_verify, device_map)
def test_get_device_mapping_from_network_for_invalid_config(self):
GlobalParams._is_normal_test = False