Fix params order in assertEqual
Fix params order to correspond to real signature:
assertEqual(expected, actual)
Change-Id: I5887e9c4fbd8953b3be9e89ce86758f8d1d842b2
Closes-Bug: #1277104
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions.py b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
index 96e68e6..9ac085a 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
@@ -70,7 +70,7 @@
# 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 @@
# 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")
diff --git a/manila_tempest_tests/tests/api/admin/test_multi_backend.py b/manila_tempest_tests/tests/api/admin/test_multi_backend.py
index 23fe1ae..86d8b61 100644
--- a/manila_tempest_tests/tests/api/admin/test_multi_backend.py
+++ b/manila_tempest_tests/tests/api/admin/test_multi_backend.py
@@ -69,7 +69,7 @@
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 @@
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):
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index d8aa4d6..badedc2 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -80,7 +80,7 @@
# 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 @@
# 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 @@
# 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 @@
# 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 @@
# 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 @@
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 @@
# 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 @@
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 @@
# 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 @@
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 @@
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):
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index c7eccb1..fb803fc 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -251,7 +251,7 @@
# 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
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py b/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py
index b664de5..a308ccf 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py
@@ -61,31 +61,31 @@
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 @@
"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):
diff --git a/manila_tempest_tests/tests/api/admin/test_shares_actions.py b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
index 5cc41f5..e630123 100644
--- a/manila_tempest_tests/tests/api/admin/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
@@ -277,14 +277,14 @@
# 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 @@
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):
diff --git a/manila_tempest_tests/tests/api/test_rules.py b/manila_tempest_tests/tests/api/test_rules.py
index 5336127..de08b86 100644
--- a/manila_tempest_tests/tests/api/test_rules.py
+++ b/manila_tempest_tests/tests/api/test_rules.py
@@ -281,7 +281,7 @@
# 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):
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 36fd6e5..9d7fc7f 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -263,21 +263,21 @@
# 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 @@
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 @@
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 @@
# 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 @@
# 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(