Fix params order in assertEqual

Fix params order to correspond to real signature:
assertEqual(expected, actual)

Change-Id: I5887e9c4fbd8953b3be9e89ce86758f8d1d842b2
Closes-Bug: #1277104
This commit is contained in:
Yatin Kumbhare 2016-01-13 12:16:06 +05:30
parent 35b8ac7c05
commit dac72337f7
9 changed files with 48 additions and 48 deletions

View File

@ -251,7 +251,7 @@ class GenericUtilsTestCase(test.TestCase):
with tempfile.NamedTemporaryFile() as f:
with utils.temporary_chown(f.name, owner_uid=2):
self.assertEqual(2, fake_execute.uid)
self.assertEqual(os.getuid(), fake_execute.uid)
self.assertEqual(fake_execute.uid, os.getuid())
def test_service_is_up(self):
fts_func = datetime.datetime.fromtimestamp

View File

@ -70,7 +70,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
# Check that status was changed
check_status = self.shares_v2_client.get_share(share["id"])
self.assertEqual(check_status["status"], self.bad_status)
self.assertEqual(self.bad_status, check_status["status"])
# Share with status 'error_deleting' should be deleted
self.shares_v2_client.force_delete(share["id"])
@ -111,7 +111,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
# Check that status was changed
check_status = self.shares_v2_client.get_snapshot(sn["id"])
self.assertEqual(check_status["status"], self.bad_status)
self.assertEqual(self.bad_status, check_status["status"])
# Snapshot with status 'error_deleting' should be deleted
self.shares_v2_client.force_delete(sn["id"], s_type="snapshots")

View File

@ -69,7 +69,7 @@ class ShareMultiBackendTest(base.BaseSharesAdminTest):
for i in [0, 1]:
get = self.shares_v2_client.get_share(self.shares[i]['id'],
version="2.5")
self.assertEqual(get["share_type"], self.sts[i]["name"])
self.assertEqual(self.sts[i]["name"], get["share_type"])
@test.attr(type=["gate", "smoke", ])
def test_share_share_type_v_2_6(self):
@ -77,8 +77,8 @@ class ShareMultiBackendTest(base.BaseSharesAdminTest):
for i in [0, 1]:
get = self.shares_v2_client.get_share(self.shares[i]['id'],
version="2.6")
self.assertEqual(get["share_type"], self.sts[i]["id"])
self.assertEqual(get["share_type_name"], self.sts[i]["name"])
self.assertEqual(self.sts[i]["id"], get["share_type"])
self.assertEqual(self.sts[i]["name"], get["share_type_name"])
@test.attr(type=["gate", ])
def test_share_export_locations(self):

View File

@ -80,7 +80,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for shares
updated = self.client.update_quotas(self.tenant_id, shares=new_quota)
self.assertEqual(int(updated["shares"]), new_quota)
self.assertEqual(new_quota, int(updated["shares"]))
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_shares(self):
@ -91,7 +91,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for shares
updated = self.client.update_quotas(
self.tenant_id, self.user_id, shares=new_quota)
self.assertEqual(int(updated["shares"]), new_quota)
self.assertEqual(new_quota, int(updated["shares"]))
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_snapshots(self):
@ -102,7 +102,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for snapshots
updated = self.client.update_quotas(
self.tenant_id, snapshots=new_quota)
self.assertEqual(int(updated["snapshots"]), new_quota)
self.assertEqual(new_quota, int(updated["snapshots"]))
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_snapshots(self):
@ -113,7 +113,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for snapshots
updated = self.client.update_quotas(
self.tenant_id, self.user_id, snapshots=new_quota)
self.assertEqual(int(updated["snapshots"]), new_quota)
self.assertEqual(new_quota, int(updated["snapshots"]))
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_gigabytes(self):
@ -126,7 +126,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for shares
updated = self.client.update_quotas(
self.tenant_id, gigabytes=gigabytes)
self.assertEqual(int(updated["gigabytes"]), gigabytes)
self.assertEqual(gigabytes, int(updated["gigabytes"]))
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_snapshot_gigabytes(self):
@ -140,8 +140,8 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
updated = self.client.update_quotas(
self.tenant_id,
snapshot_gigabytes=snapshot_gigabytes)
self.assertEqual(
int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
self.assertEqual(snapshot_gigabytes,
int(updated["snapshot_gigabytes"]))
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_gigabytes(self):
@ -154,7 +154,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for shares
updated = self.client.update_quotas(
self.tenant_id, self.user_id, gigabytes=gigabytes)
self.assertEqual(int(updated["gigabytes"]), gigabytes)
self.assertEqual(gigabytes, int(updated["gigabytes"]))
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_snapshot_gigabytes(self):
@ -168,8 +168,8 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
updated = self.client.update_quotas(
self.tenant_id, self.user_id,
snapshot_gigabytes=snapshot_gigabytes)
self.assertEqual(
int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
self.assertEqual(snapshot_gigabytes,
int(updated["snapshot_gigabytes"]))
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_share_networks(self):
@ -180,7 +180,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# set new quota for share-networks
updated = self.client.update_quotas(
self.tenant_id, share_networks=new_quota)
self.assertEqual(int(updated["share_networks"]), new_quota)
self.assertEqual(new_quota, int(updated["share_networks"]))
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_share_networks(self):
@ -193,7 +193,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
updated = self.client.update_quotas(
self.tenant_id, self.user_id,
share_networks=new_quota)
self.assertEqual(int(updated["share_networks"]), new_quota)
self.assertEqual(new_quota, int(updated["share_networks"]))
@test.attr(type=["gate", "smoke", ])
def test_reset_tenant_quotas(self):
@ -218,23 +218,23 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
gigabytes=gigabytes,
snapshot_gigabytes=snapshot_gigabytes,
share_networks=share_networks)
self.assertEqual(int(updated["shares"]), shares)
self.assertEqual(int(updated["snapshots"]), snapshots)
self.assertEqual(int(updated["gigabytes"]), gigabytes)
self.assertEqual(
int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
self.assertEqual(int(updated["share_networks"]), share_networks)
self.assertEqual(shares, int(updated["shares"]))
self.assertEqual(snapshots, int(updated["snapshots"]))
self.assertEqual(gigabytes, int(updated["gigabytes"]))
self.assertEqual(snapshot_gigabytes,
int(updated["snapshot_gigabytes"]))
self.assertEqual(share_networks, int(updated["share_networks"]))
# reset customized quotas
self.client.reset_quotas(self.tenant_id)
# verify quotas
reseted = self.client.show_quotas(self.tenant_id)
self.assertEqual(int(reseted["shares"]), int(default["shares"]))
self.assertEqual(int(reseted["snapshots"]), int(default["snapshots"]))
self.assertEqual(int(reseted["gigabytes"]), int(default["gigabytes"]))
self.assertEqual(int(reseted["share_networks"]),
int(default["share_networks"]))
self.assertEqual(int(default["shares"]), int(reseted["shares"]))
self.assertEqual(int(default["snapshots"]), int(reseted["snapshots"]))
self.assertEqual(int(default["gigabytes"]), int(reseted["gigabytes"]))
self.assertEqual(int(default["share_networks"]),
int(reseted["share_networks"]))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_quota_for_shares(self):

View File

@ -251,7 +251,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
# List shares by share server id, we expect empty list
params = {"share_server_id": serv["id"]}
empty = self.shares_client.list_shares_with_detail(params)
self.assertEqual(len(empty), 0)
self.assertEqual(0, len(empty))
if delete_share_network:
# Delete share network, it should trigger share server deletion

View File

@ -61,31 +61,31 @@ class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
def test_list_share_servers_with_wrong_filter_key(self):
search_opts = {'fake_filter_key': 'ACTIVE'}
servers = self.shares_client.list_share_servers(search_opts)
self.assertEqual(len(servers), 0)
self.assertEqual(0, len(servers))
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_share_servers_with_wrong_filter_value(self):
search_opts = {'host': 123}
servers = self.shares_client.list_share_servers(search_opts)
self.assertEqual(len(servers), 0)
self.assertEqual(0, len(servers))
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_share_servers_with_fake_status(self):
search_opts = {"status": data_utils.rand_name("fake_status")}
servers = self.shares_client.list_share_servers(search_opts)
self.assertEqual(len(servers), 0)
self.assertEqual(0, len(servers))
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_share_servers_with_fake_host(self):
search_opts = {"host": data_utils.rand_name("fake_host")}
servers = self.shares_client.list_share_servers(search_opts)
self.assertEqual(len(servers), 0)
self.assertEqual(0, len(servers))
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_share_servers_with_fake_project(self):
search_opts = {"project_id": data_utils.rand_name("fake_project_id")}
servers = self.shares_client.list_share_servers(search_opts)
self.assertEqual(len(servers), 0)
self.assertEqual(0, len(servers))
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_share_servers_with_fake_share_network(self):
@ -93,7 +93,7 @@ class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
"share_network": data_utils.rand_name("fake_share_network"),
}
servers = self.shares_client.list_share_servers(search_opts)
self.assertEqual(len(servers), 0)
self.assertEqual(0, len(servers))
@test.attr(type=["gate", "smoke", "negative", ])
def test_delete_share_server_with_nonexistent_id(self):

View File

@ -277,14 +277,14 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
# verify response
self.assertTrue(len(shares) > 0)
sorted_list = [share['created_at'] for share in shares]
self.assertEqual(sorted_list, sorted(sorted_list))
self.assertEqual(sorted(sorted_list), sorted_list)
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_existed_name(self):
# list shares by name, at least one share is expected
params = {"name": self.share_name}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(shares[0]["name"], self.share_name)
self.assertEqual(self.share_name, shares[0]["name"])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_fake_name(self):
@ -300,7 +300,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
shares = self.shares_client.list_shares_with_detail(params)
self.assertTrue(len(shares) > 0)
for share in shares:
self.assertEqual(share["status"], params["status"])
self.assertEqual(params["status"], share["status"])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_fake_status(self):

View File

@ -281,7 +281,7 @@ class ShareRulesTest(base.BaseSharesTest):
# our share id in list and have no duplicates
gen = [r["id"] for r in rules if r["id"] in rule["id"]]
msg = "expected id lists %s times in rule list" % (len(gen))
self.assertEqual(len(gen), 1, msg)
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
def test_access_rules_deleted_if_share_deleted(self):

View File

@ -263,21 +263,21 @@ class SharesActionsTest(base.BaseSharesTest):
# verify response
self.assertTrue(len(shares) > 0)
sorted_list = [share['created_at'] for share in shares]
self.assertEqual(sorted_list, sorted(sorted_list))
self.assertEqual(sorted(sorted_list), sorted_list)
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_existed_name(self):
# list shares by name, at least one share is expected
params = {"name": self.share_name}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(shares[0]["name"], self.share_name)
self.assertEqual(self.share_name, shares[0]["name"])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_fake_name(self):
# list shares by fake name, no shares are expected
params = {"name": data_utils.rand_name("fake-nonexistent-name")}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(len(shares), 0)
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_active_status(self):
@ -286,14 +286,14 @@ class SharesActionsTest(base.BaseSharesTest):
shares = self.shares_client.list_shares_with_detail(params)
self.assertTrue(len(shares) > 0)
for share in shares:
self.assertEqual(share["status"], params["status"])
self.assertEqual(params["status"], share["status"])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_fake_status(self):
# list shares by fake status, no shares are expected
params = {"status": 'fake'}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(len(shares), 0)
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_all_tenants(self):
@ -306,7 +306,7 @@ class SharesActionsTest(base.BaseSharesTest):
share = self.shares_client.get_share(self.shares[0]["id"])
project_id = share["project_id"]
for share in shares:
self.assertEqual(share["project_id"], project_id)
self.assertEqual(project_id, share["project_id"])
@test.attr(type=["gate", ])
def test_list_shares_public_with_detail(self):
@ -405,7 +405,7 @@ class SharesActionsTest(base.BaseSharesTest):
# our share id in list and have no duplicates
gen = [sid["id"] for sid in snaps if sid["id"] in self.snap["id"]]
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(len(gen), 1, msg)
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
@ -462,7 +462,7 @@ class SharesActionsTest(base.BaseSharesTest):
# verify response
self.assertTrue(len(snaps) > 0)
sorted_list = [snap['share_id'] for snap in snaps]
self.assertEqual(sorted_list, sorted(sorted_list))
self.assertEqual(sorted(sorted_list), sorted_list)
@test.attr(type=["gate", ])
@testtools.skipUnless(