diff --git a/manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py b/manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py index 69abe05090..1d97631ce7 100644 --- a/manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py +++ b/manila/tests/share/drivers/emc/plugins/isilon/test_isilon_api.py @@ -433,7 +433,7 @@ class IsilonApiTest(test.TestCase): r = self.isilon_api.delete_nfs_share(share_number) self.assertEqual(1, len(m.request_history)) - self.assertEqual(r, expected_return_value) + self.assertEqual(expected_return_value, r) @ddt.data((204, True), (404, False)) def test_delete_smb_shares(self, data): @@ -449,7 +449,7 @@ class IsilonApiTest(test.TestCase): r = self.isilon_api.delete_smb_share(share_name) self.assertEqual(1, len(m.request_history)) - self.assertEqual(r, expected_return_value) + self.assertEqual(expected_return_value, r) @requests_mock.mock() def test_delete_snapshot(self, m): diff --git a/manila/tests/share/drivers/emc/plugins/vnx/test_emc_vnx.py b/manila/tests/share/drivers/emc/plugins/vnx/test_emc_vnx.py index 91e8c90293..c351c5fb36 100644 --- a/manila/tests/share/drivers/emc/plugins/vnx/test_emc_vnx.py +++ b/manila/tests/share/drivers/emc/plugins/vnx/test_emc_vnx.py @@ -1347,7 +1347,7 @@ class EMCShareDriverVNXTestCase(test.TestCase): ssh_calls = [mock.call(TD.create_nfs_export(vdm_name, '/fakename'))] helper.XMLAPIConnector.request.assert_has_calls(expected_calls) helper.SSHConnector.run_ssh.assert_has_calls(ssh_calls) - self.assertEqual(location, '192.168.1.1:/%s' % share['name'], + self.assertEqual('192.168.1.1:/%s' % share['name'], location, "NFS export path is incorrect") @ddt.data(fake_share.fake_share(), @@ -1489,7 +1489,7 @@ class EMCShareDriverVNXTestCase(test.TestCase): ] helper.XMLAPIConnector.request.assert_has_calls(expected_calls) helper.SSHConnector.run_ssh.assert_has_calls(ssh_calls) - self.assertEqual(location, '\\\\192.168.1.2\\%s' % share['name'], + self.assertEqual('\\\\192.168.1.2\\%s' % share['name'], location, "CIFS export path is incorrect") def test_delete_cifs_share_default(self): diff --git a/manila/tests/share/drivers/test_generic.py b/manila/tests/share/drivers/test_generic.py index 5eeec299f0..629334fd16 100644 --- a/manila/tests/share/drivers/test_generic.py +++ b/manila/tests/share/drivers/test_generic.py @@ -247,7 +247,7 @@ class GenericShareDriverTestCase(test.TestCase): self._driver._ssh_exec, self.fake_conf ) - self.assertEqual(len(self._driver._helpers), 1) + self.assertEqual(1, len(self._driver._helpers)) def test_setup_helpers_no_helpers(self): self._driver._helpers = {} @@ -292,7 +292,7 @@ class GenericShareDriverTestCase(test.TestCase): result = self._driver.create_share( self._context, self.share, share_server=self.server) - self.assertEqual(result, 'fakelocation') + self.assertEqual('fakelocation', result) self._driver._allocate_container.assert_called_once_with( self._driver.admin_context, self.share) self._driver._attach_volume.assert_called_once_with( @@ -422,18 +422,18 @@ class GenericShareDriverTestCase(test.TestCase): self._driver._unmount_device(self.share, self.server) self.assertEqual(1, time.sleep.call_count) - self.assertEqual(self._driver._get_mount_path.mock_calls, - [mock.call(self.share) for i in moves.range(2)]) - self.assertEqual(self._driver._is_device_mounted.mock_calls, - [mock.call(mount_path, - self.server) for i in moves.range(2)]) + self.assertEqual([mock.call(self.share) for i in moves.range(2)], + self._driver._get_mount_path.mock_calls) + self.assertEqual([mock.call(mount_path, + self.server) for i in moves.range(2)], + self._driver._is_device_mounted.mock_calls) self._driver._sync_mount_temp_and_perm_files.assert_called_once_with( self.server) self.assertEqual( - self._driver._ssh_exec.mock_calls, [mock.call(self.server, ['sudo umount', mount_path, '&& sudo rmdir', mount_path]) - for i in moves.range(2)] + for i in moves.range(2)], + self._driver._ssh_exec.mock_calls, ) def test_unmount_device_not_present(self): @@ -464,7 +464,7 @@ class GenericShareDriverTestCase(test.TestCase): self._driver._ssh_exec.assert_called_once_with( self.server, ['sudo', 'mount']) - self.assertEqual(result, True) + self.assertTrue(result) def test_is_device_mounted_true_no_volume_provided(self): mount_path = '/fake/mount/path' @@ -476,7 +476,7 @@ class GenericShareDriverTestCase(test.TestCase): self._driver._ssh_exec.assert_called_once_with( self.server, ['sudo', 'mount']) - self.assertEqual(result, True) + self.assertTrue(result) def test_is_device_mounted_false(self): mount_path = '/fake/mount/path' @@ -491,7 +491,7 @@ class GenericShareDriverTestCase(test.TestCase): self._driver._ssh_exec.assert_called_once_with( self.server, ['sudo', 'mount']) - self.assertEqual(result, False) + self.assertEqual(False, result) def test_is_device_mounted_false_no_volume_provided(self): mount_path = '/fake/mount/path' @@ -505,7 +505,7 @@ class GenericShareDriverTestCase(test.TestCase): self._driver._ssh_exec.assert_called_once_with( self.server, ['sudo', 'mount']) - self.assertEqual(result, False) + self.assertEqual(False, result) def test_sync_mount_temp_and_perm_files(self): self.mock_object(self._driver, '_ssh_exec') @@ -549,8 +549,8 @@ class GenericShareDriverTestCase(test.TestCase): def test_get_mount_path(self): result = self._driver._get_mount_path(self.share) - self.assertEqual(result, os.path.join(CONF.share_mount_path, - self.share['name'])) + self.assertEqual(os.path.join(CONF.share_mount_path, + self.share['name']), result) def test_attach_volume_not_attached(self): available_volume = fake_volume.FakeVolume() @@ -567,7 +567,7 @@ class GenericShareDriverTestCase(test.TestCase): available_volume['id']) self._driver.volume_api.get.assert_called_once_with( self._context, attached_volume['id']) - self.assertEqual(result, attached_volume) + self.assertEqual(attached_volume, result) def test_attach_volume_attached_correct(self): fake_server = fake_compute.FakeServer() @@ -578,7 +578,7 @@ class GenericShareDriverTestCase(test.TestCase): result = self._driver._attach_volume(self._context, self.share, fake_server, attached_volume) - self.assertEqual(result, attached_volume) + self.assertEqual(attached_volume, result) def test_attach_volume_attached_incorrect(self): fake_server = fake_compute.FakeServer() @@ -620,7 +620,7 @@ class GenericShareDriverTestCase(test.TestCase): result = self._driver._attach_volume(self._context, self.share, fake_server, attached_volume) - self.assertEqual(result, in_use_volume) + self.assertEqual(in_use_volume, result) self.assertEqual( 2, self._driver.compute_api.instance_volume_attach.call_count) @@ -642,7 +642,7 @@ class GenericShareDriverTestCase(test.TestCase): self.mock_object(self._driver.volume_api, 'get_all', mock.Mock(return_value=[volume])) result = self._driver._get_volume(self._context, self.share['id']) - self.assertEqual(result, volume) + self.assertEqual(volume, result) self._driver.volume_api.get_all.assert_called_once_with( self._context, {'all_tenants': True, 'name': volume['name']}) @@ -655,7 +655,7 @@ class GenericShareDriverTestCase(test.TestCase): result = self._driver._get_volume(self._context, self.share['id']) - self.assertEqual(result, volume) + self.assertEqual(volume, result) self._driver.volume_api.get.assert_called_once_with( self._context, volume['id']) self.fake_private_storage.get.assert_called_once_with( @@ -693,7 +693,7 @@ class GenericShareDriverTestCase(test.TestCase): mock.Mock(return_value=[volume_snapshot])) result = self._driver._get_volume_snapshot(self._context, self.snapshot['id']) - self.assertEqual(result, volume_snapshot) + self.assertEqual(volume_snapshot, result) self._driver.volume_api.get_all_snapshots.assert_called_once_with( self._context, {'name': volume_snapshot['name']}) @@ -705,7 +705,7 @@ class GenericShareDriverTestCase(test.TestCase): mock.Mock(return_value=volume_snapshot['id'])) result = self._driver._get_volume_snapshot(self._context, self.snapshot['id']) - self.assertEqual(result, volume_snapshot) + self.assertEqual(volume_snapshot, result) self._driver.volume_api.get_snapshot.assert_called_once_with( self._context, volume_snapshot['id']) self.fake_private_storage.get.assert_called_once_with( @@ -784,7 +784,7 @@ class GenericShareDriverTestCase(test.TestCase): mock.Mock(return_value=fake_vol)) result = self._driver._allocate_container(self._context, self.share) - self.assertEqual(result, fake_vol) + self.assertEqual(fake_vol, result) self._driver.volume_api.create.assert_called_once_with( self._context, self.share['size'], @@ -805,7 +805,7 @@ class GenericShareDriverTestCase(test.TestCase): result = self._driver._allocate_container(self._context, self.share, self.snapshot) - self.assertEqual(result, fake_vol) + self.assertEqual(fake_vol, result) self._driver.volume_api.create.assert_called_once_with( self._context, self.share['size'], @@ -933,7 +933,7 @@ class GenericShareDriverTestCase(test.TestCase): self.snapshot, share_server=self.server) - self.assertEqual(result, 'fakelocation') + self.assertEqual('fakelocation', result) self._driver._allocate_container.assert_called_once_with( self._driver.admin_context, self.share, self.snapshot) self._driver._attach_volume.assert_called_once_with( @@ -2028,7 +2028,7 @@ class NFSHelperTestCase(test.TestCase): expected_location = ':'.join([self.server['public_address'], os.path.join(CONF.share_mount_path, self.share_name)]) - self.assertEqual(ret, expected_location) + self.assertEqual(expected_location, ret) @ddt.data(const.ACCESS_LEVEL_RW, const.ACCESS_LEVEL_RO) def test_allow_access(self, data): @@ -2179,7 +2179,7 @@ class CIFSHelperTestCase(test.TestCase): ret = self._helper.create_export(self.server_details, self.share_name) expected_location = '\\\\%s\\%s' % ( self.server_details['public_address'], self.share_name) - self.assertEqual(ret, expected_location) + self.assertEqual(expected_location, ret) share_path = os.path.join( self._helper.configuration.share_mount_path, self.share_name) @@ -2203,7 +2203,7 @@ class CIFSHelperTestCase(test.TestCase): recreate=True) expected_location = '\\\\%s\\%s' % ( self.server_details['public_address'], self.share_name) - self.assertEqual(ret, expected_location) + self.assertEqual(expected_location, ret) share_path = os.path.join( self._helper.configuration.share_mount_path, self.share_name) diff --git a/manila/tests/share/drivers/test_service_instance.py b/manila/tests/share/drivers/test_service_instance.py index d7c2dc74ae..006e1e9c58 100644 --- a/manila/tests/share/drivers/test_service_instance.py +++ b/manila/tests/share/drivers/test_service_instance.py @@ -383,14 +383,14 @@ class ServiceInstanceManagerTestCase(test.TestCase): net_name = self._manager.get_config_option('service_network_name') fake_server = dict(networks={net_name: [ip]}) result = self._manager._get_server_ip(fake_server, net_name) - self.assertEqual(result, ip) + self.assertEqual(ip, result) def test_get_server_ip_found_in_addresses_section(self): ip = '10.0.0.1' net_name = self._manager.get_config_option('service_network_name') fake_server = dict(addresses={net_name: [dict(addr=ip, version=4)]}) result = self._manager._get_server_ip(fake_server, net_name) - self.assertEqual(result, ip) + self.assertEqual(ip, result) @ddt.data( {}, @@ -419,7 +419,7 @@ class ServiceInstanceManagerTestCase(test.TestCase): mock.Mock(return_value=[fake_secgroup, ])) result = self._manager._get_or_create_security_group( self._manager.admin_context) - self.assertEqual(result, fake_secgroup) + self.assertEqual(fake_secgroup, result) self._manager.get_config_option.assert_has_calls([ mock.call('service_instance_security_group'), ]) @@ -444,7 +444,7 @@ class ServiceInstanceManagerTestCase(test.TestCase): name=None, description=desc, ) - self.assertEqual(result, fake_secgroup) + self.assertEqual(fake_secgroup, result) self._manager.compute_api.security_group_list.assert_called_once_with( self._manager.admin_context) self._manager.compute_api.security_group_create.\ @@ -469,7 +469,7 @@ class ServiceInstanceManagerTestCase(test.TestCase): self._manager.compute_api.security_group_create.\ assert_called_once_with( self._manager.admin_context, name, mock.ANY) - self.assertEqual(result, fake_secgroup) + self.assertEqual(fake_secgroup, result) def test_security_group_two_sg_in_list(self): name = "fake_name" @@ -688,12 +688,12 @@ class ServiceInstanceManagerTestCase(test.TestCase): def test_get_key_keypath_to_public_not_set(self): self._manager.path_to_public_key = None result = self._manager._get_key(self._manager.admin_context) - self.assertEqual(result, (None, None)) + self.assertEqual((None, None), result) def test_get_key_keypath_to_private_not_set(self): self._manager.path_to_private_key = None result = self._manager._get_key(self._manager.admin_context) - self.assertEqual(result, (None, None)) + self.assertEqual((None, None), result) def test_get_key_incorrect_keypath_to_public(self): def exists_side_effect(path): @@ -705,7 +705,7 @@ class ServiceInstanceManagerTestCase(test.TestCase): with mock.patch.object(os.path, 'expanduser', mock.Mock(side_effect=lambda value: value)): result = self._manager._get_key(self._manager.admin_context) - self.assertEqual(result, (None, None)) + self.assertEqual((None, None), result) def test_get_key_incorrect_keypath_to_private(self): def exists_side_effect(path): @@ -717,7 +717,7 @@ class ServiceInstanceManagerTestCase(test.TestCase): with mock.patch.object(os.path, 'expanduser', mock.Mock(side_effect=lambda value: value)): result = self._manager._get_key(self._manager.admin_context) - self.assertEqual(result, (None, None)) + self.assertEqual((None, None), result) def test_get_service_image(self): fake_image1 = fake_compute.FakeImage( @@ -1962,7 +1962,7 @@ class NeutronNetworkHelperTestCase(test.TestCase): host_id='fake_host') service_instance.socket.gethostname.assert_called_once_with() self.assertFalse(instance.neutron_api.update_port_fixed_ips.called) - self.assertEqual(result, fake_service_port) + self.assertEqual(fake_service_port, result) def test__get_service_port_one_exist(self): instance = self._init_neutron_network_plugin() @@ -1980,7 +1980,7 @@ class NeutronNetworkHelperTestCase(test.TestCase): device_id='manila-share') self.assertFalse(instance.neutron_api.create_port.called) self.assertFalse(instance.neutron_api.update_port_fixed_ips.called) - self.assertEqual(result, fake_service_port) + self.assertEqual(fake_service_port, result) def test__get_service_port_two_exist(self): instance = self._init_neutron_network_plugin() diff --git a/manila/tests/share/drivers/windows/test_windows_smb_driver.py b/manila/tests/share/drivers/windows/test_windows_smb_driver.py index d1d225c29b..21151b4527 100644 --- a/manila/tests/share/drivers/windows/test_windows_smb_driver.py +++ b/manila/tests/share/drivers/windows/test_windows_smb_driver.py @@ -210,7 +210,7 @@ class WindowsSMBDriverTestCase(test.TestCase): mock.sentinel.mount_path, mock.sentinel.server) - self.assertEqual(share_size, fake_size_gb) + self.assertEqual(fake_size_gb, share_size) def test_get_consumed_space(self): fake_size_gb = 2 diff --git a/manila/tests/share/test_api.py b/manila/tests/share/test_api.py index 137f3437b6..9a3bf59577 100644 --- a/manila/tests/share/test_api.py +++ b/manila/tests/share/test_api.py @@ -298,7 +298,7 @@ class ShareAPITestCase(test.TestCase): ctx, sort_dir='desc', sort_key='created_at', project_id='fake_pid_1', filters={}, is_public=False ) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[0]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[0], shares) def test_get_all_admin_filter_by_all_tenants(self): ctx = context.RequestContext('fake_uid', 'fake_pid_1', is_admin=True) @@ -309,7 +309,7 @@ class ShareAPITestCase(test.TestCase): ctx, 'share', 'get_all') db_api.share_get_all.assert_called_once_with( ctx, sort_dir='desc', sort_key='created_at', filters={}) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES, shares) def test_get_all_non_admin_filter_by_share_server(self): @@ -351,7 +351,7 @@ class ShareAPITestCase(test.TestCase): ) db_api.share_get_all_by_project.assert_has_calls([]) db_api.share_get_all.assert_has_calls([]) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[2:]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[2:], shares) def test_get_all_admin_filter_by_name(self): ctx = context.RequestContext('fake_uid', 'fake_pid_2', is_admin=True) @@ -365,7 +365,7 @@ class ShareAPITestCase(test.TestCase): ctx, sort_dir='desc', sort_key='created_at', project_id='fake_pid_2', filters={}, is_public=False ) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[1::2]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[1::2], shares) def test_get_all_admin_filter_by_name_and_all_tenants(self): ctx = context.RequestContext('fake_uid', 'fake_pid_2', is_admin=True) @@ -377,7 +377,7 @@ class ShareAPITestCase(test.TestCase): ]) db_api.share_get_all.assert_called_once_with( ctx, sort_dir='desc', sort_key='created_at', filters={}) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[::2]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[::2], shares) def test_get_all_admin_filter_by_status(self): ctx = context.RequestContext('fake_uid', 'fake_pid_2', is_admin=True) @@ -391,7 +391,7 @@ class ShareAPITestCase(test.TestCase): ctx, sort_dir='desc', sort_key='created_at', project_id='fake_pid_2', filters={}, is_public=False ) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[2::4]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[2::4], shares) def test_get_all_admin_filter_by_status_and_all_tenants(self): ctx = context.RequestContext('fake_uid', 'fake_pid_2', is_admin=True) @@ -404,7 +404,7 @@ class ShareAPITestCase(test.TestCase): ]) db_api.share_get_all.assert_called_once_with( ctx, sort_dir='desc', sort_key='created_at', filters={}) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[1::2]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[1::2], shares) def test_get_all_non_admin_filter_by_all_tenants(self): # Expected share list only by project of non-admin user @@ -419,7 +419,7 @@ class ShareAPITestCase(test.TestCase): ctx, sort_dir='desc', sort_key='created_at', project_id='fake_pid_2', filters={}, is_public=False ) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[1:]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[1:], shares) def test_get_all_non_admin_with_name_and_status_filters(self): ctx = context.RequestContext('fake_uid', 'fake_pid_2', is_admin=False) @@ -436,12 +436,12 @@ class ShareAPITestCase(test.TestCase): ) # two items expected, one filtered - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[1::2]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[1::2], shares) # one item expected, two filtered shares = self.api.get_all( ctx, {'name': 'foo', 'status': constants.STATUS_AVAILABLE}) - self.assertEqual(shares, _FAKE_LIST_OF_ALL_SHARES[2::4]) + self.assertEqual(_FAKE_LIST_OF_ALL_SHARES[2::4], shares) share_api.policy.check_policy.assert_has_calls([ mock.call(ctx, 'share', 'get_all'), mock.call(ctx, 'share', 'get_all'), @@ -996,7 +996,7 @@ class ShareAPITestCase(test.TestCase): with mock.patch.object(db_api, 'share_snapshot_get', mock.Mock(return_value=fake_get_snap)): rule = self.api.get_snapshot(self.context, 'fakeid') - self.assertEqual(rule, fake_get_snap) + self.assertEqual(fake_get_snap, rule) share_api.policy.check_policy.assert_called_once_with( self.context, 'share', 'get_snapshot') db_api.share_snapshot_get.assert_called_once_with( @@ -1145,7 +1145,7 @@ class ShareAPITestCase(test.TestCase): with mock.patch.object(db_api, 'share_get', mock.Mock(return_value=share)): result = self.api.get(self.context, 'fakeid') - self.assertEqual(result, share) + self.assertEqual(share, result) share_api.policy.check_policy.assert_called_once_with( self.context, 'share', 'get', share) db_api.share_get.assert_called_once_with( @@ -1422,7 +1422,7 @@ class ShareAPITestCase(test.TestCase): with mock.patch.object(db_api, 'share_access_get', mock.Mock(return_value='fake')): rule = self.api.access_get(self.context, 'fakeid') - self.assertEqual(rule, 'fake') + self.assertEqual('fake', rule) share_api.policy.check_policy.assert_called_once_with( self.context, 'share', 'access_get') db_api.share_access_get.assert_called_once_with( diff --git a/manila/tests/share/test_drivers_private_data.py b/manila/tests/share/test_drivers_private_data.py index 39576cbbf7..333ce672db 100644 --- a/manila/tests/share/test_drivers_private_data.py +++ b/manila/tests/share/test_drivers_private_data.py @@ -40,7 +40,7 @@ class DriverPrivateDataTestCase(test.TestCase): def test_custom_storage_driver(self): private_data = pd.DriverPrivateData(storage=self.fake_storage) - self.assertEqual(private_data._storage, self.fake_storage) + self.assertEqual(self.fake_storage, private_data._storage) def test_invalid_parameters(self): self.assertRaises(ValueError, pd.DriverPrivateData) diff --git a/manila/tests/share/test_manager.py b/manila/tests/share/test_manager.py index 190fa086c9..4788926f3f 100644 --- a/manila/tests/share/test_manager.py +++ b/manila/tests/share/test_manager.py @@ -395,8 +395,8 @@ class ShareManagerTestCase(test.TestCase): share_id).id) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_AVAILABLE) - self.assertEqual(shr['share_server_id'], server['id']) + self.assertEqual(constants.STATUS_AVAILABLE, shr['status']) + self.assertEqual(server['id'], shr['share_server_id']) def test_create_share_instance_from_snapshot_with_server_not_found(self): """Test creation from snapshot fails if server not found.""" @@ -415,7 +415,7 @@ class ShareManagerTestCase(test.TestCase): ) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_ERROR) + self.assertEqual(constants.STATUS_ERROR, shr['status']) def test_create_share_instance_from_snapshot(self): """Test share can be created from snapshot.""" @@ -430,7 +430,7 @@ class ShareManagerTestCase(test.TestCase): share_id).id) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_AVAILABLE) + self.assertEqual(constants.STATUS_AVAILABLE, shr['status']) self.assertTrue(len(shr['export_location']) > 0) self.assertEqual(2, len(shr['export_locations'])) @@ -456,7 +456,7 @@ class ShareManagerTestCase(test.TestCase): snapshot_id).share_id) snap = db.share_snapshot_get(self.context, snapshot_id) - self.assertEqual(snap['status'], constants.STATUS_AVAILABLE) + self.assertEqual(constants.STATUS_AVAILABLE, snap['status']) self.share_manager.delete_snapshot(self.context, snapshot_id) self.assertRaises(exception.NotFound, @@ -485,7 +485,7 @@ class ShareManagerTestCase(test.TestCase): self.context, share_id, snapshot_id) snap = db.share_snapshot_get(self.context, snapshot_id) - self.assertEqual(snap['status'], constants.STATUS_ERROR) + self.assertEqual(constants.STATUS_ERROR, snap['status']) self.assertRaises(exception.NotFound, self.share_manager.delete_snapshot, @@ -517,7 +517,7 @@ class ShareManagerTestCase(test.TestCase): self.share_manager.delete_snapshot(self.context, snapshot_id) snap = db.share_snapshot_get(self.context, snapshot_id) - self.assertEqual(snap['status'], constants.STATUS_AVAILABLE) + self.assertEqual(constants.STATUS_AVAILABLE, snap['status']) self.share_manager.driver.delete_snapshot.assert_called_once_with( utils.IsAMatcher(context.RequestContext), utils.IsAMatcher(models.ShareSnapshotInstance), @@ -642,7 +642,7 @@ class ShareManagerTestCase(test.TestCase): ) manager.LOG.error.assert_called_with(mock.ANY, share.instance['id']) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_ERROR) + self.assertEqual(constants.STATUS_ERROR, shr['status']) def test_create_share_instance_with_share_network_server_exists(self): """Test share can be created with existing share server.""" @@ -715,8 +715,8 @@ class ShareManagerTestCase(test.TestCase): self.assertEqual(share_id, db.share_get(context.get_admin_context(), share_id).id) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_AVAILABLE) - self.assertEqual(shr['share_server_id'], 'fake_srv_id') + self.assertEqual(constants.STATUS_AVAILABLE, shr['status']) + self.assertEqual('fake_srv_id', shr['share_server_id']) db.share_server_create.assert_called_once_with( utils.IsAMatcher(context.RequestContext), mock.ANY) self.share_manager._setup_server.assert_called_once_with( @@ -741,14 +741,14 @@ class ShareManagerTestCase(test.TestCase): share.instance['id']) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_ERROR) + self.assertEqual(constants.STATUS_ERROR, shr['status']) self.assertRaises(exception.NotFound, self.share_manager.delete_share_instance, self.context, share.instance['id']) shr = db.share_get(self.context, share_id) - self.assertEqual(shr['status'], constants.STATUS_ERROR_DELETING) + self.assertEqual(constants.STATUS_ERROR_DELETING, shr['status']) self.share_manager.driver.create_share.assert_called_once_with( utils.IsAMatcher(context.RequestContext), utils.IsAMatcher(models.ShareInstance), @@ -1322,7 +1322,7 @@ class ShareManagerTestCase(test.TestCase): access_id) acs = db.share_access_get(self.context, access_id) - self.assertEqual(acs['state'], constants.STATUS_ERROR) + self.assertEqual(constants.STATUS_ERROR, acs['state']) self.assertRaises(exception.NotFound, self.share_manager.deny_access, @@ -1331,7 +1331,7 @@ class ShareManagerTestCase(test.TestCase): access_id) acs = db.share_access_get(self.context, access_id) - self.assertEqual(acs['state'], constants.STATUS_ERROR) + self.assertEqual(constants.STATUS_ERROR, acs['state']) def test_setup_server(self): # Setup required test data diff --git a/manila/tests/share/test_rpcapi.py b/manila/tests/share/test_rpcapi.py index b7689d0a29..0683ad2ecb 100644 --- a/manila/tests/share/test_rpcapi.py +++ b/manila/tests/share/test_rpcapi.py @@ -113,7 +113,7 @@ class ShareRpcAPITestCase(test.TestCase): def _fake_prepare_method(*args, **kwds): for kwd in kwds: - self.assertEqual(kwds[kwd], target[kwd]) + self.assertEqual(target[kwd], kwds[kwd]) return self.rpcapi.client def _fake_rpc_method(*args, **kwargs): @@ -127,13 +127,13 @@ class ShareRpcAPITestCase(test.TestCase): retval = getattr(self.rpcapi, method)(self.ctxt, **kwargs) - self.assertEqual(retval, expected_retval) + self.assertEqual(expected_retval, retval) expected_args = [self.ctxt, method] for arg, expected_arg in zip(self.fake_args, expected_args): - self.assertEqual(arg, expected_arg) + self.assertEqual(expected_arg, arg) for kwarg, value in six.iteritems(self.fake_kwargs): - self.assertEqual(value, expected_msg[kwarg]) + self.assertEqual(expected_msg[kwarg], value) def test_create_share_instance(self): self._test_share_api('create_share_instance',