From: Nate Potter Date: Wed, 21 Oct 2015 19:07:16 +0000 (+0000) Subject: Correct assertDictMatch argument order X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=01a3190d44085b5e5663273651fb4afc56b96ade;p=openstack-build%2Fcinder-build.git Correct assertDictMatch argument order Patch to fix the order of the arguments in assertDictMatch to (expected, observed) in instances where it was in the wrong order. Closes-Bug: #1259292 Change-Id: I969d780ea06190ba5362106ee2b8efa1ee43927c --- diff --git a/cinder/tests/unit/api/contrib/test_qos_specs_manage.py b/cinder/tests/unit/api/contrib/test_qos_specs_manage.py index 837376f68..749572be6 100644 --- a/cinder/tests/unit/api/contrib/test_qos_specs_manage.py +++ b/cinder/tests/unit/api/contrib/test_qos_specs_manage.py @@ -379,7 +379,7 @@ class QoSSpecManageApiTest(test.TestCase): body = {'qos_specs': {'key1': 'value1', 'key2': 'value2'}} res = self.controller.update(req, '555', body) - self.assertDictMatch(res, body) + self.assertDictMatch(body, res) self.assertEqual(1, notifier.get_notification_count()) @mock.patch('cinder.volume.qos_specs.update', @@ -677,7 +677,7 @@ class TestQoSSpecsTemplate(test.TestCase): continue new_dict.update({element.tag: element.text}) - self.assertDictMatch(new_dict, qos_dict['specs']) + self.assertDictMatch(qos_dict['specs'], new_dict) class TestAssociationsTemplate(test.TestCase): diff --git a/cinder/tests/unit/api/contrib/test_quotas.py b/cinder/tests/unit/api/contrib/test_quotas.py index 4739e6ce5..e4f4335bc 100644 --- a/cinder/tests/unit/api/contrib/test_quotas.py +++ b/cinder/tests/unit/api/contrib/test_quotas.py @@ -176,13 +176,13 @@ class QuotaSetsControllerTest(test.TestCase): 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(result, expected) + self.assertDictMatch(expected, result) # An 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(result, expected) + self.assertDictMatch(expected, result) def test_subproject_show_target_project_equals_to_context_project(self): self.controller._get_project = mock.Mock() @@ -190,7 +190,7 @@ class QuotaSetsControllerTest(test.TestCase): 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(result, expected) + self.assertDictMatch(expected, result) def test_show_not_authorized(self): self.controller._get_project = mock.Mock() @@ -231,13 +231,13 @@ class QuotaSetsControllerTest(test.TestCase): 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(result, body) + self.assertDictMatch(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(result, body) + self.assertDictMatch(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 @@ -250,7 +250,7 @@ class QuotaSetsControllerTest(test.TestCase): 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(result, body) + self.assertDictMatch(body, result) # An admin of B can also update the quota of D, since D is its an # immediate child. self.req.environ['cinder.context'].project_id = self.B.id @@ -274,7 +274,7 @@ class QuotaSetsControllerTest(test.TestCase): 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(result, body) + self.assertDictMatch(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 @@ -291,7 +291,7 @@ class QuotaSetsControllerTest(test.TestCase): 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(result, body) + self.assertDictMatch(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 @@ -436,13 +436,13 @@ class QuotaSetsControllerTest(test.TestCase): self.controller._get_project = mock.Mock() self.controller._get_project.side_effect = self._get_project result_show = self.controller.show(self.req, 'foo') - self.assertDictMatch(result_show, make_body()) + self.assertDictMatch(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, 'foo', body) - self.assertDictMatch(result_update, body) + self.assertDictMatch(body, result_update) self.controller.delete(self.req, 'foo') @@ -458,14 +458,14 @@ class QuotaSetsControllerTest(test.TestCase): volumes=5, backups=5, backup_gigabytes=1000, tenant_id=None) result_update = self.controller.update(self.req, self.A.id, body) - self.assertDictMatch(result_update, body) + self.assertDictMatch(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(result_update, body) + self.assertDictMatch(body, result_update) self.controller.delete(self.req, self.B.id) @@ -509,14 +509,14 @@ class QuotaSetsControllerTest(test.TestCase): volumes=5, backups=5, backup_gigabytes=1000, tenant_id=None) result_update = self.controller.update(self.req, self.A.id, body) - self.assertDictMatch(result_update, body) + self.assertDictMatch(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(result_update, body) + self.assertDictMatch(body, result_update) self.controller.delete(self.req, self.B.id) diff --git a/cinder/tests/unit/api/contrib/test_quotas_classes.py b/cinder/tests/unit/api/contrib/test_quotas_classes.py index 17bdffb44..58a5ed18c 100644 --- a/cinder/tests/unit/api/contrib/test_quotas_classes.py +++ b/cinder/tests/unit/api/contrib/test_quotas_classes.py @@ -93,7 +93,7 @@ class QuotaClassSetsControllerTest(test.TestCase): def test_show(self): volume_types.create(self.ctxt, 'fake_type') result = self.controller.show(self.req, 'foo') - self.assertDictMatch(result, make_body()) + self.assertDictMatch(make_body(), result) def test_show_not_authorized(self): self.req.environ['cinder.context'].is_admin = False @@ -107,7 +107,7 @@ class QuotaClassSetsControllerTest(test.TestCase): body = make_body(gigabytes=2000, snapshots=15, volumes=5, tenant_id=None) result = self.controller.update(self.req, 'foo', body) - self.assertDictMatch(result, body) + self.assertDictMatch(body, result) @mock.patch('cinder.api.openstack.wsgi.Controller.validate_string_length') @mock.patch('cinder.api.openstack.wsgi.Controller.validate_integer') @@ -124,7 +124,7 @@ class QuotaClassSetsControllerTest(test.TestCase): volume_types.create(self.ctxt, 'fake_type') body = {'quota_class_set': {'bad': 'bad'}} result = self.controller.update(self.req, 'foo', body) - self.assertDictMatch(result, make_body(tenant_id=None)) + self.assertDictMatch(make_body(tenant_id=None), result) def test_update_invalid_key_value(self): body = {'quota_class_set': {'gigabytes': "should_be_int"}} @@ -147,10 +147,11 @@ class QuotaClassSetsControllerTest(test.TestCase): body = {'quota_class_set': {'gigabytes_fake_type_1': 1111, 'volumes_fake_type_2': 2222}} result = self.controller.update(self.req, 'foo', body) - self.assertDictMatch(result, make_response_body(ctxt=self.ctxt, - quota_class='foo', - request_body=body, - tenant_id=None)) + self.assertDictMatch(make_response_body(ctxt=self.ctxt, + quota_class='foo', + request_body=body, + tenant_id=None), + result) class QuotaClassesSerializerTest(test.TestCase): diff --git a/cinder/tests/unit/api/contrib/test_scheduler_stats.py b/cinder/tests/unit/api/contrib/test_scheduler_stats.py index 975711282..96b8e5c08 100644 --- a/cinder/tests/unit/api/contrib/test_scheduler_stats.py +++ b/cinder/tests/unit/api/contrib/test_scheduler_stats.py @@ -69,7 +69,7 @@ class SchedulerStatsAPITest(test.TestCase): ] } - self.assertDictMatch(res, expected) + self.assertDictMatch(expected, res) def test_get_pools_detail(self): req = fakes.HTTPRequest.blank('/v2/fake/scheduler_stats?detail=True') @@ -107,4 +107,4 @@ class SchedulerStatsAPITest(test.TestCase): ] } - self.assertDictMatch(res, expected) + self.assertDictMatch(expected, res) diff --git a/cinder/tests/unit/api/contrib/test_volume_actions.py b/cinder/tests/unit/api/contrib/test_volume_actions.py index c2078d597..0a72048c6 100644 --- a/cinder/tests/unit/api/contrib/test_volume_actions.py +++ b/cinder/tests/unit/api/contrib/test_volume_actions.py @@ -621,7 +621,7 @@ class VolumeImageActionsTest(test.TestCase): 'container_format': 'bare', 'disk_format': 'raw', 'image_name': 'image_name'}} - self.assertDictMatch(res_dict, expected) + self.assertDictMatch(expected, res_dict) def test_copy_volume_to_image_volumenotfound(self): def stub_volume_get_raise_exc(self, context, volume_id): @@ -808,7 +808,7 @@ class VolumeImageActionsTest(test.TestCase): } } - self.assertDictMatch(res_dict, expected_res) + self.assertDictMatch(expected_res, res_dict) def test_copy_volume_to_image_without_glance_metadata(self): """Test create image from volume if volume is created without image. @@ -865,7 +865,7 @@ class VolumeImageActionsTest(test.TestCase): } } - self.assertDictMatch(res_dict, expected_res) + self.assertDictMatch(expected_res, res_dict) def test_copy_volume_to_image_without_protected_prop(self): """Test protected property is not defined with the root image.""" @@ -919,7 +919,7 @@ class VolumeImageActionsTest(test.TestCase): } } - self.assertDictMatch(res_dict, expected_res) + self.assertDictMatch(expected_res, res_dict) def test_copy_volume_to_image_without_core_prop(self): """Test glance_core_properties defined in cinder.conf is empty.""" @@ -966,4 +966,4 @@ class VolumeImageActionsTest(test.TestCase): } } - self.assertDictMatch(res_dict, expected_res) + self.assertDictMatch(expected_res, res_dict) diff --git a/cinder/tests/unit/api/v1/test_limits.py b/cinder/tests/unit/api/v1/test_limits.py index b26ef9ef1..7ca8afc94 100644 --- a/cinder/tests/unit/api/v1/test_limits.py +++ b/cinder/tests/unit/api/v1/test_limits.py @@ -806,7 +806,7 @@ class LimitsViewBuilderTest(test.TestCase): output = self.view_builder.build(self.rate_limits, self.absolute_limits) - self.assertDictMatch(output, expected_limits) + self.assertDictMatch(expected_limits, output) def test_build_limits_empty_limits(self): expected_limits = {"limits": {"rate": [], @@ -815,7 +815,7 @@ class LimitsViewBuilderTest(test.TestCase): abs_limits = {} rate_limits = [] output = self.view_builder.build(rate_limits, abs_limits) - self.assertDictMatch(output, expected_limits) + self.assertDictMatch(expected_limits, output) class LimitsXMLSerializationTest(test.TestCase): diff --git a/cinder/tests/unit/api/v1/test_types.py b/cinder/tests/unit/api/v1/test_types.py index cdb9b4e83..773c3ce22 100644 --- a/cinder/tests/unit/api/v1/test_types.py +++ b/cinder/tests/unit/api/v1/test_types.py @@ -130,7 +130,7 @@ class VolumeTypesApiTest(test.TestCase): description=None, is_public=None, id=42) - self.assertDictMatch(output['volume_type'], expected_volume_type) + self.assertDictMatch(expected_volume_type, output['volume_type']) def test_view_builder_list(self): view_builder = views_types.ViewBuilder() @@ -157,8 +157,8 @@ class VolumeTypesApiTest(test.TestCase): id=42 + i, is_public=None, description=None) - self.assertDictMatch(output['volume_types'][i], - expected_volume_type) + self.assertDictMatch(expected_volume_type, + output['volume_types'][i]) class VolumeTypesSerializerTest(test.TestCase): diff --git a/cinder/tests/unit/api/v2/test_types.py b/cinder/tests/unit/api/v2/test_types.py index d05e28d99..1b11631e7 100644 --- a/cinder/tests/unit/api/v2/test_types.py +++ b/cinder/tests/unit/api/v2/test_types.py @@ -173,7 +173,7 @@ class VolumeTypesApiTest(test.TestCase): is_public=True, id=42, ) - self.assertDictMatch(output['volume_type'], expected_volume_type) + self.assertDictMatch(expected_volume_type, output['volume_type']) def test_view_builder_show_admin(self): view_builder = views_types.ViewBuilder() @@ -238,8 +238,8 @@ class VolumeTypesApiTest(test.TestCase): is_public=True, id=42 + i ) - self.assertDictMatch(output['volume_types'][i], - expected_volume_type) + self.assertDictMatch(expected_volume_type, + output['volume_types'][i]) def test_view_builder_list_admin(self): view_builder = views_types.ViewBuilder() diff --git a/cinder/tests/unit/db/test_qos_specs.py b/cinder/tests/unit/db/test_qos_specs.py index eaabb5a9e..6326243bb 100644 --- a/cinder/tests/unit/db/test_qos_specs.py +++ b/cinder/tests/unit/db/test_qos_specs.py @@ -77,7 +77,7 @@ class QualityOfServiceSpecsTableTestCase(test.TestCase): expected = dict(name='Name1', id=specs_id, consumer='front-end') del value['consumer'] expected.update(dict(specs=value)) - self.assertDictMatch(specs, expected) + self.assertDictMatch(expected, specs) def test_qos_specs_get_all(self): value1 = dict(consumer='front-end', @@ -119,7 +119,7 @@ class QualityOfServiceSpecsTableTestCase(test.TestCase): 'id': specs_id, 'consumer': 'front-end', 'specs': value} - self.assertDictMatch(specs, expected) + self.assertDictMatch(expected, specs) def test_qos_specs_delete(self): name = str(int(time.time())) @@ -143,7 +143,7 @@ class QualityOfServiceSpecsTableTestCase(test.TestCase): 'specs': value} db.qos_specs_item_delete(self.ctxt, specs_id, 'foo') specs = db.qos_specs_get_by_name(self.ctxt, name) - self.assertDictMatch(specs, expected) + self.assertDictMatch(expected, specs) def test_associate_type_with_qos(self): self.assertRaises(exception.VolumeTypeNotFound, diff --git a/cinder/tests/unit/image/test_glance.py b/cinder/tests/unit/image/test_glance.py index 8a265e108..9084f10e8 100644 --- a/cinder/tests/unit/image/test_glance.py +++ b/cinder/tests/unit/image/test_glance.py @@ -149,10 +149,10 @@ class TestGlanceImageService(test.TestCase): 'properties': {'instance_id': '42', 'user_id': 'fake'}, 'owner': None, } - self.assertDictMatch(image_meta, expected) + self.assertDictMatch(expected, image_meta) image_metas = self.service.detail(self.context) - self.assertDictMatch(image_metas[0], expected) + self.assertDictMatch(expected, image_metas[0]) def test_create_without_instance_id(self): """Test Creating images without instance_id. @@ -183,7 +183,7 @@ class TestGlanceImageService(test.TestCase): 'owner': None, } actual = self.service.show(self.context, image_id) - self.assertDictMatch(actual, expected) + self.assertDictMatch(expected, actual) def test_create(self): fixture = self._make_fixture(name='test image') @@ -254,7 +254,7 @@ class TestGlanceImageService(test.TestCase): 'owner': None, } - self.assertDictMatch(meta, expected) + self.assertDictMatch(expected, meta) i = i + 1 def test_detail_limit(self): @@ -310,7 +310,7 @@ class TestGlanceImageService(test.TestCase): 'deleted': None, 'owner': None, } - self.assertDictMatch(meta, expected) + self.assertDictMatch(expected, meta) i = i + 1 def test_detail_invalid_marker(self): diff --git a/cinder/tests/unit/scheduler/test_host_manager.py b/cinder/tests/unit/scheduler/test_host_manager.py index 6d89f7ee2..c31292c9d 100644 --- a/cinder/tests/unit/scheduler/test_host_manager.py +++ b/cinder/tests/unit/scheduler/test_host_manager.py @@ -91,7 +91,7 @@ class HostManagerTestCase(test.TestCase): @mock.patch('oslo_utils.timeutils.utcnow') def test_update_service_capabilities(self, _mock_utcnow): service_states = self.host_manager.service_states - self.assertDictMatch(service_states, {}) + self.assertDictMatch({}, service_states) _mock_utcnow.side_effect = [31337, 31338, 31339] host1_volume_capabs = dict(free_capacity_gb=4321, timestamp=1) @@ -610,4 +610,4 @@ class PoolStateTestCase(test.TestCase): self.assertEqual(512, fake_pool.provisioned_capacity_gb) - self.assertDictMatch(fake_pool.capabilities, volume_capability) + self.assertDictMatch(volume_capability, fake_pool.capabilities) diff --git a/cinder/tests/unit/test_hpe3par.py b/cinder/tests/unit/test_hpe3par.py index eb665bbd0..df6d19421 100644 --- a/cinder/tests/unit/test_hpe3par.py +++ b/cinder/tests/unit/test_hpe3par.py @@ -3599,7 +3599,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase): expected + self.standard_logout) - self.assertDictMatch(result, self.properties) + self.assertDictMatch(self.properties, result) @mock.patch('cinder.zonemanager.utils.create_lookup_service') def test_initialize_connection_with_lookup_single_nsp(self, mock_lookup): @@ -3692,7 +3692,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase): expected + self.standard_logout) - self.assertDictMatch(result, expected_properties) + self.assertDictMatch(expected_properties, result) def test_initialize_connection_encrypted(self): # setup_mock_client drive with default configuration @@ -3767,7 +3767,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase): expected_properties = self.properties expected_properties['data']['encrypted'] = True - self.assertDictMatch(result, expected_properties) + self.assertDictMatch(expected_properties, result) def test_terminate_connection(self): # setup_mock_client drive with default configuration @@ -4527,7 +4527,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase): expected + self.standard_logout) - self.assertDictMatch(result, self.properties) + self.assertDictMatch(self.properties, result) def test_initialize_connection_multipath(self): # setup_mock_client drive with default configuration @@ -4699,7 +4699,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase): expected_properties = self.properties expected_properties['data']['encrypted'] = True - self.assertDictMatch(result, self.properties) + self.assertDictMatch(self.properties, result) def test_get_volume_stats(self): # setup_mock_client drive with the configuration diff --git a/cinder/tests/unit/test_hplefthand.py b/cinder/tests/unit/test_hplefthand.py index e1eee13dd..acd437a7f 100644 --- a/cinder/tests/unit/test_hplefthand.py +++ b/cinder/tests/unit/test_hplefthand.py @@ -509,7 +509,7 @@ class TestHPLeftHandCLIQISCSIDriver(HPLeftHandBaseDriver, test.TestCase): result = self.driver.initialize_connection(volume, self.connector) self.assertEqual('iscsi', result['driver_volume_type']) - self.assertDictMatch(result['data'], self.properties) + self.assertDictMatch(self.properties, result['data']) expected = [ mock.call( diff --git a/cinder/tests/unit/test_infortrend_cli.py b/cinder/tests/unit/test_infortrend_cli.py index 6533baca1..0e7614773 100644 --- a/cinder/tests/unit/test_infortrend_cli.py +++ b/cinder/tests/unit/test_infortrend_cli.py @@ -2170,9 +2170,9 @@ class InfortrendCLITestCase(test.TestCase): if isinstance(out, list): for i in range(len(test_data[1])): - self.assertDictMatch(out[i], test_data[1][i]) + self.assertDictMatch(test_data[1][i], out[i]) else: - self.assertDictMatch(out, test_data[1]) + self.assertDictMatch(test_data[1], out) @mock.patch.object(cli.LOG, 'debug', mock.Mock()) def test_cli_all_command_execute(self): diff --git a/cinder/tests/unit/test_infortrend_common.py b/cinder/tests/unit/test_infortrend_common.py index 299514822..fb5d61e0a 100644 --- a/cinder/tests/unit/test_infortrend_common.py +++ b/cinder/tests/unit/test_infortrend_common.py @@ -123,8 +123,8 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): self.driver._init_map_info(True) - self.assertDictMatch(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(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(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(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(properties, self.cli_data.test_fc_properties) + self.assertDictMatch(self.cli_data.test_fc_properties, properties) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_initialize_connection_specific_channel(self): @@ -185,7 +185,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): test_volume, test_connector) self.assertDictMatch( - properties, self.cli_data.test_fc_properties_with_specific_channel) + self.cli_data.test_fc_properties_with_specific_channel, properties) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_initialize_connection_with_diff_target_id(self): @@ -219,7 +219,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): self._assert_cli_has_calls(expect_cli_cmd) self.assertDictMatch( - properties, self.cli_data.test_fc_properties_with_specific_channel) + self.cli_data.test_fc_properties_with_specific_channel, properties) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_initialize_connection_multipath_with_r_model(self): @@ -239,7 +239,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): test_volume, test_connector) self.assertDictMatch( - properties, self.cli_data.test_fc_properties_multipath_r_model) + self.cli_data.test_fc_properties_multipath_r_model, properties) def test_initialize_connection_with_get_wwn_fail(self): @@ -305,7 +305,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): self._assert_cli_has_calls(expect_cli_cmd) self.assertDictMatch( - properties, self.cli_data.test_fc_properties_zoning) + self.cli_data.test_fc_properties_zoning, properties) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_initialize_connection_with_zoning_r_model(self): @@ -354,7 +354,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): self._assert_cli_has_calls(expect_cli_cmd) self.assertDictMatch( - properties, self.cli_data.test_fc_properties_zoning_r_model) + self.cli_data.test_fc_properties_zoning_r_model, properties) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_initialize_connection_with_zoning_r_model_diff_target_id(self): @@ -404,7 +404,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): self._assert_cli_has_calls(expect_cli_cmd) self.assertDictMatch( - properties, self.cli_data.test_fc_properties_zoning_r_model) + self.cli_data.test_fc_properties_zoning_r_model, properties) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_terminate_connection(self): @@ -465,7 +465,7 @@ class InfortrendFCCommonTestCase(InfortrendTestCass): self._assert_cli_has_calls(expect_cli_cmd) self.assertDictMatch( - conn_info, self.cli_data.test_fc_terminate_conn_info) + self.cli_data.test_fc_terminate_conn_info, conn_info) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_terminate_connection_with_zoning_and_lun_map_exist(self): @@ -598,8 +598,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): self.driver._init_map_info() - self.assertDictMatch(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(test_target_dict, self.driver.target_dict) def test_normal_channel_with_multipath(self): @@ -618,8 +618,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): self.driver._init_map_info(multipath=True) - self.assertDictMatch(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(test_target_dict, self.driver.target_dict) def test_specific_channel(self): @@ -641,8 +641,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): self.driver._init_map_info() - self.assertDictMatch(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(test_target_dict, self.driver.target_dict) def test_update_mcs_dict(self): @@ -660,7 +660,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): self.driver._init_map_info() - self.assertDictMatch(self.driver.mcs_dict, test_mcs_dict) + self.assertDictMatch(test_mcs_dict, self.driver.mcs_dict) def test_mapping_info_with_mcs(self): @@ -688,7 +688,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): map_chl, map_lun, mcs_id = self.driver._get_mapping_info_with_mcs() - self.assertDictMatch(map_chl, test_map_chl) + self.assertDictMatch(test_map_chl, map_chl) self.assertEqual(test_map_lun, map_lun) self.assertEqual(test_mcs_id, mcs_id) @@ -724,7 +724,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): map_chl, map_lun, mcs_id = self.driver._get_mapping_info_with_mcs() - self.assertDictMatch(map_chl, test_map_chl) + self.assertDictMatch(test_map_chl, map_chl) self.assertEqual(test_map_lun, map_lun) self.assertEqual(test_mcs_id, mcs_id) @@ -748,8 +748,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): self.driver._init_map_info(multipath=True) - self.assertDictMatch(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(test_target_dict, self.driver.target_dict) def test_specific_channel_with_multipath_r_model(self): @@ -772,8 +772,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): self.driver._init_map_info(multipath=True) - self.assertDictMatch(self.driver.map_dict, test_map_dict) - self.assertDictMatch(self.driver.target_dict, test_target_dict) + self.assertDictMatch(test_map_dict, self.driver.map_dict) + self.assertDictMatch(test_target_dict, self.driver.target_dict) @mock.patch.object(common_cli.LOG, 'info') def test_create_volume(self, log_info): @@ -795,7 +795,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): model_update = self.driver.create_volume(test_volume) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) self.assertEqual(1, log_info.call_count) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) @@ -970,7 +970,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): model_update = self.driver.create_cloned_volume( test_dst_volume, test_src_volume) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) self.assertEqual(1, log_info.call_count) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) @@ -1005,7 +1005,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): model_update = self.driver.create_export(None, test_volume) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) def test_get_volume_stats(self): @@ -1022,7 +1022,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): volume_states = self.driver.get_volume_stats(True) - self.assertDictMatch(volume_states, test_volume_states) + self.assertDictMatch(test_volume_states, volume_states) def test_get_volume_stats_fail(self): @@ -1204,7 +1204,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): model_update = self.driver.create_volume_from_snapshot( test_dst_volume, test_snapshot) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) self.assertEqual(1, log_info.call_count) @mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall', @@ -1243,7 +1243,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): model_update = self.driver.create_volume_from_snapshot( test_dst_volume, test_snapshot) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) self.assertEqual(1, log_info.call_count) def test_create_volume_from_snapshot_without_provider_location( @@ -1287,7 +1287,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): properties = self.driver.initialize_connection( test_volume, test_connector) - self.assertDictMatch(properties, test_iscsi_properties) + self.assertDictMatch(test_iscsi_properties, properties) expect_cli_cmd = [ mock.call('CreateMap', 'part', test_partition_id, '2', '0', '0', @@ -1324,7 +1324,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): properties = self.driver.initialize_connection( test_volume, test_connector) - self.assertDictMatch(properties, test_iscsi_properties) + self.assertDictMatch(test_iscsi_properties, properties) expect_cli_cmd = [ mock.call('CreateIQN', test_initiator, test_initiator[-16:]), @@ -1359,7 +1359,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): test_volume, test_connector) self.assertDictMatch( - properties, self.cli_data.test_iscsi_properties_empty_map) + self.cli_data.test_iscsi_properties_empty_map, properties) def test_initialize_connection_with_create_map_fail(self): @@ -1430,7 +1430,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): properties = self.driver.initialize_connection( test_volume, test_connector) - self.assertDictMatch(properties, test_iscsi_properties) + self.assertDictMatch(test_iscsi_properties, properties) expect_cli_cmd = [ mock.call('CreateMap', 'part', test_partition_id, '1', '0', '2', @@ -1588,7 +1588,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): ] self._assert_cli_has_calls(expect_cli_cmd) self.assertTrue(rc) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) @mock.patch.object(common_cli.LOG, 'warning') def test_migrate_volume_with_invalid_storage(self, log_warning): @@ -1833,7 +1833,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): ] self._assert_cli_has_calls(expect_cli_cmd) self.assertEqual(1, log_info.call_count) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) def test_manage_existing_rename_fail(self): @@ -1903,7 +1903,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): ] self._assert_cli_has_calls(expect_cli_cmd) self.assertEqual(1, log_info.call_count) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) @mock.patch.object(common_cli.LOG, 'info') def test_unmanage(self, log_info): @@ -2022,7 +2022,7 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCass): ] self._assert_cli_has_calls(expect_cli_cmd) self.assertTrue(rc) - self.assertDictMatch(model_update, test_model_update) + self.assertDictMatch(test_model_update, model_update) @mock.patch.object(common_cli.LOG, 'debug', mock.Mock()) @mock.patch.object(common_cli.LOG, 'info', mock.Mock()) diff --git a/cinder/tests/unit/test_prophetstor_dpl.py b/cinder/tests/unit/test_prophetstor_dpl.py index 56c4060d3..f840e46ab 100644 --- a/cinder/tests/unit/test_prophetstor_dpl.py +++ b/cinder/tests/unit/test_prophetstor_dpl.py @@ -696,7 +696,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': 'deleted'}, model_update, ) + self.assertDictMatch({'status': 'deleted'}, model_update) def test_update_consistencygroup(self): self.DPL_MOCK.get_vg.return_value = (0, DATA_OUT_CG) diff --git a/cinder/tests/unit/test_qos_specs.py b/cinder/tests/unit/test_qos_specs.py index e397aa5e8..ef4048dca 100644 --- a/cinder/tests/unit/test_qos_specs.py +++ b/cinder/tests/unit/test_qos_specs.py @@ -67,7 +67,7 @@ class QoSSpecsTestCase(test.TestCase): expected.update(dict(name='FakeName')) del input['consumer'] expected.update(dict(specs=input)) - self.assertDictMatch(specs, expected) + self.assertDictMatch(expected, specs) self.stubs.Set(db, 'qos_specs_create', fake_db_qos_specs_create) diff --git a/cinder/tests/unit/zonemanager/test_brcd_fc_san_lookup_service.py b/cinder/tests/unit/zonemanager/test_brcd_fc_san_lookup_service.py index a42b7bb04..4598fec30 100644 --- a/cinder/tests/unit/zonemanager/test_brcd_fc_san_lookup_service.py +++ b/cinder/tests/unit/zonemanager/test_brcd_fc_san_lookup_service.py @@ -111,7 +111,7 @@ class TestBrcdFCSanLookupService(brcd_lookup.BrcdFCSanLookupService, get_nameserver_info_mock.return_value = parsed_switch_port_wwns device_map = self.get_device_mapping_from_network( initiator_list, target_list) - self.assertDictMatch(device_map, _device_map_to_verify) + self.assertDictMatch(_device_map_to_verify, device_map) @mock.patch.object(brcd_lookup.BrcdFCSanLookupService, '_get_switch_data') def test_get_nameserver_info(self, get_switch_data_mock): diff --git a/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py b/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py index 3f1c18876..b60306781 100644 --- a/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py +++ b/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py @@ -82,7 +82,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_returned, active_zoneset) + self.assertDictMatch(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): diff --git a/cinder/tests/unit/zonemanager/test_brcd_lookup_service.py b/cinder/tests/unit/zonemanager/test_brcd_lookup_service.py index 17f860ebe..8a5d076f4 100644 --- a/cinder/tests/unit/zonemanager/test_brcd_lookup_service.py +++ b/cinder/tests/unit/zonemanager/test_brcd_lookup_service.py @@ -57,7 +57,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, _device_map_to_verify) + self.assertDictMatch(_device_map_to_verify, device_map) def test_get_device_mapping_from_network_for_invalid_config(self): GlobalParams._is_normal_test = False diff --git a/cinder/tests/unit/zonemanager/test_cisco_fc_san_lookup_service.py b/cinder/tests/unit/zonemanager/test_cisco_fc_san_lookup_service.py index 6ca16d33f..154285326 100644 --- a/cinder/tests/unit/zonemanager/test_cisco_fc_san_lookup_service.py +++ b/cinder/tests/unit/zonemanager/test_cisco_fc_san_lookup_service.py @@ -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, _device_map_to_verify) + self.assertDictMatch(_device_map_to_verify, device_map) @mock.patch.object(cisco_lookup.CiscoFCSanLookupService, '_get_switch_info') diff --git a/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py b/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py index 60b2421cb..9e63a9c2b 100644 --- a/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py +++ b/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py @@ -139,7 +139,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_returned, active_zoneset) + self.assertDictMatch(active_zoneset, active_zoneset_returned) @mock.patch.object(cli.CiscoFCZoneClientCLI, '_run_ssh') def test_get_active_zone_set_ssh_error(self, run_ssh_mock): @@ -153,7 +153,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_returned, zoning_status_basic) + self.assertDictMatch(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): @@ -162,8 +162,8 @@ 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_returned, - zoning_status_enhanced_nosess) + self.assertDictMatch(zoning_status_enhanced_nosess, + zoning_status_returned) @mock.patch.object(cli.CiscoFCZoneClientCLI, '_get_switch_info') def test_get_zoning_status_enhanced_sess(self, get_zoning_status_mock): @@ -171,8 +171,8 @@ 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_returned, - zoning_status_enhanced_sess) + self.assertDictMatch(zoning_status_enhanced_sess, + zoning_status_returned) @mock.patch.object(cli.CiscoFCZoneClientCLI, '_get_switch_info') def test_get_nameserver_info(self, get_switch_info_mock): diff --git a/cinder/tests/unit/zonemanager/test_cisco_lookup_service.py b/cinder/tests/unit/zonemanager/test_cisco_lookup_service.py index b2b4c171c..678fd83da 100644 --- a/cinder/tests/unit/zonemanager/test_cisco_lookup_service.py +++ b/cinder/tests/unit/zonemanager/test_cisco_lookup_service.py @@ -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, _device_map_to_verify) + self.assertDictMatch(_device_map_to_verify, device_map) def test_get_device_mapping_from_network_for_invalid_config(self): GlobalParams._is_normal_test = False