Merge "Make argument params of list methods consistent"
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index 1aa1615..d9a1ee5 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -109,8 +109,7 @@
self.addCleanup(self.client.delete_agent, agent_xen['agent_id'])
agent_id_xen = agent_xen['agent_id']
- params_filter = {'hypervisor': agent_xen['hypervisor']}
- agents = self.client.list_agents(params_filter)
+ agents = self.client.list_agents(hypervisor=agent_xen['hypervisor'])
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(agent_id_xen, map(lambda x: x['agent_id'], agents))
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 9fee2a1..0dadea5 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -38,9 +38,7 @@
self.useFixture(fixtures.LockFixture('availability_zone'))
hosts = self.client.list_hosts()
host = hosts[0]
- zone_name = host['zone']
- params = {'zone': zone_name}
- hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(zone=host['zone'])
self.assertTrue(len(hosts) >= 1)
self.assertIn(host, hosts)
@@ -48,16 +46,14 @@
def test_list_hosts_with_a_blank_zone(self):
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
- params = {'zone': ''}
- hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(zone='')
self.assertNotEqual(0, len(hosts))
@test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
def test_list_hosts_with_nonexistent_zone(self):
# If send the request with a nonexistent zone, the request will be
# successful and no hosts will be retured
- params = {'zone': 'xxx'}
- hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(zone='xxx')
self.assertEqual(0, len(hosts))
@test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index 2c3c629..ff87a4f 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -69,8 +69,7 @@
security_group_list.append(adm_securitygroup)
# Fetch all security groups based on 'all_tenants' search filter
- param = {'all_tenants': 'true'}
- fetched_list = self.adm_client.list_security_groups(params=param)
+ fetched_list = self.adm_client.list_security_groups(all_tenants='true')
sec_group_id_list = map(lambda sg: sg['id'], fetched_list)
# Now check if all created Security Groups are present in fetched list
for sec_group in security_group_list:
@@ -78,7 +77,7 @@
# Fetch all security groups for non-admin user with 'all_tenants'
# search filter
- fetched_list = self.client.list_security_groups(params=param)
+ fetched_list = self.client.list_security_groups(all_tenants='true')
# Now check if all created Security Groups are present in fetched list
for sec_group in fetched_list:
self.assertEqual(sec_group['tenant_id'], client_tenant_id,
diff --git a/tempest/api/compute/admin/test_services.py b/tempest/api/compute/admin/test_services.py
index dd3e78c..db22925 100644
--- a/tempest/api/compute/admin/test_services.py
+++ b/tempest/api/compute/admin/test_services.py
@@ -37,8 +37,7 @@
@test.idempotent_id('f345b1ec-bc6e-4c38-a527-3ca2bc00bef5')
def test_get_service_by_service_binary_name(self):
binary_name = 'nova-compute'
- params = {'binary': binary_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(binary=binary_name)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(binary_name, service['binary'])
@@ -49,9 +48,8 @@
host_name = services[0]['host']
services_on_host = [service for service in services if
service['host'] == host_name]
- params = {'host': host_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(host=host_name)
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -67,9 +65,9 @@
services = self.client.list_services()
host_name = services[0]['host']
binary_name = services[0]['binary']
- params = {'host': host_name, 'binary': binary_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(host=host_name,
+ binary=binary_name)
self.assertEqual(1, len(services))
self.assertEqual(host_name, services[0]['host'])
self.assertEqual(binary_name, services[0]['binary'])
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index 99f31c5..b9335c9 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.py
@@ -41,8 +41,7 @@
def test_get_service_by_invalid_params(self):
# return all services if send the request with invalid parameter
services = self.client.list_services()
- params = {'xxx': 'nova-compute'}
- services_xxx = self.client.list_services(params)
+ services_xxx = self.client.list_services(xxx='nova-compute')
self.assertEqual(len(services), len(services_xxx))
@test.attr(type=['negative'])
@@ -50,8 +49,7 @@
def test_get_service_by_invalid_service_and_valid_host(self):
services = self.client.list_services()
host_name = services[0]['host']
- params = {'host': host_name, 'binary': 'xxx'}
- services = self.client.list_services(params)
+ services = self.client.list_services(host=host_name, binary='xxx')
self.assertEqual(0, len(services))
@test.attr(type=['negative'])
@@ -59,6 +57,5 @@
def test_get_service_with_valid_service_and_invalid_host(self):
services = self.client.list_services()
binary_name = services[0]['binary']
- params = {'host': 'xxx', 'binary': binary_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(host='xxx', binary=binary_name)
self.assertEqual(0, len(services))
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index 02085e8..1c9e5d7 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -49,28 +49,22 @@
@test.idempotent_id('062c8ae9-9912-4249-8b51-e38d664e926e')
def test_list_usage_all_tenants(self):
# Get usage for all tenants
- params = {'start': self.start,
- 'end': self.end,
- 'detailed': int(bool(True))}
- tenant_usage = self.adm_client.list_tenant_usages(params)
+ tenant_usage = self.adm_client.list_tenant_usages(
+ start=self.start, end=self.end, detailed=int(bool(True)))
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('94135049-a4c5-4934-ad39-08fa7da4f22e')
def test_get_usage_tenant(self):
# Get usage for a specific tenant
- params = {'start': self.start,
- 'end': self.end}
tenant_usage = self.adm_client.show_tenant_usage(
- self.tenant_id, params)
+ self.tenant_id, start=self.start, end=self.end)
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('9d00a412-b40e-4fd9-8eba-97b496316116')
def test_get_usage_tenant_with_non_admin_user(self):
# Get usage for a specific tenant with non admin user
- params = {'start': self.start,
- 'end': self.end}
tenant_usage = self.client.show_tenant_usage(
- self.tenant_id, params)
+ self.tenant_id, start=self.start, end=self.end)
self.assertEqual(len(tenant_usage), 8)
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
index 3c66859..934fc31 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -48,7 +48,7 @@
'end': self.end}
self.assertRaises(lib_exc.NotFound,
self.adm_client.show_tenant_usage,
- '', params)
+ '', **params)
@test.attr(type=['negative'])
@test.idempotent_id('4079dd2a-9e8d-479f-869d-6fa985ce45b6')
@@ -58,7 +58,7 @@
'end': self.start}
self.assertRaises(lib_exc.BadRequest,
self.adm_client.show_tenant_usage,
- self.client.tenant_id, params)
+ self.client.tenant_id, **params)
@test.attr(type=['negative'])
@test.idempotent_id('bbe6fe2c-15d8-404c-a0a2-44fad0ad5cc7')
@@ -68,4 +68,4 @@
'end': self.end,
'detailed': int(bool(True))}
self.assertRaises(lib_exc.Forbidden,
- self.client.list_tenant_usages, params)
+ self.client.list_tenant_usages, **params)
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 525946e..1269991 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -24,7 +24,7 @@
Tests Agents API
"""
- def list_agents(self, params=None):
+ def list_agents(self, **params):
"""List all agent builds."""
url = 'os-agents'
if params:
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
index 20be790..8165292 100644
--- a/tempest/services/compute/json/baremetal_nodes_client.py
+++ b/tempest/services/compute/json/baremetal_nodes_client.py
@@ -25,7 +25,7 @@
Tests Baremetal API
"""
- def list_baremetal_nodes(self, params=None):
+ def list_baremetal_nodes(self, **params):
"""List all baremetal nodes."""
url = 'os-baremetal-nodes'
if params:
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 8923d64..2193949 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -23,7 +23,7 @@
class FloatingIPsClient(service_client.ServiceClient):
- def list_floating_ips(self, params=None):
+ def list_floating_ips(self, **params):
"""Returns a list of all floating IPs filtered by any parameters."""
url = 'os-floating-ips'
if params:
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index d597a06..752af68 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -21,7 +21,7 @@
class HostsClient(service_client.ServiceClient):
- def list_hosts(self, params=None):
+ def list_hosts(self, **params):
"""Lists all hosts."""
url = 'os-hosts'
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
index 2a2bcd2..06c8f13 100644
--- a/tempest/services/compute/json/migrations_client.py
+++ b/tempest/services/compute/json/migrations_client.py
@@ -21,7 +21,7 @@
class MigrationsClient(service_client.ServiceClient):
- def list_migrations(self, params=None):
+ def list_migrations(self, **params):
"""Lists all migrations."""
url = 'os-migrations'
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index bee8d41..5a3d771 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -23,7 +23,7 @@
class SecurityGroupsClient(service_client.ServiceClient):
- def list_security_groups(self, params=None):
+ def list_security_groups(self, **params):
"""List all security groups for a user."""
url = 'os-security-groups'
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index e1b48bb..699d3e7 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -23,7 +23,7 @@
class ServicesClient(service_client.ServiceClient):
- def list_services(self, params=None):
+ def list_services(self, **params):
url = 'os-services'
if params:
url += '?%s' % urllib.urlencode(params)
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
index cd9f3b6..72fcde2 100644
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ b/tempest/services/compute/json/tenant_usages_client.py
@@ -22,7 +22,7 @@
class TenantUsagesClient(service_client.ServiceClient):
- def list_tenant_usages(self, params=None):
+ def list_tenant_usages(self, **params):
url = 'os-simple-tenant-usage'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -32,7 +32,7 @@
self.validate_response(schema.list_tenant_usage, resp, body)
return service_client.ResponseBodyList(resp, body['tenant_usages'][0])
- def show_tenant_usage(self, tenant_id, params=None):
+ def show_tenant_usage(self, tenant_id, **params):
url = 'os-simple-tenant-usage/%s' % tenant_id
if params:
url += '?%s' % urllib.urlencode(params)
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index d9b430e..b785156 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -47,7 +47,7 @@
pass
secgrp_client = admin_manager.security_groups_client
- secgrp = secgrp_client.list_security_groups({"all_tenants": True})
+ secgrp = secgrp_client.list_security_groups(all_tenants=True)
secgrp_del = [grp for grp in secgrp if grp['name'] != 'default']
LOG.info("Cleanup::remove %s Security Group" % len(secgrp_del))
for g in secgrp_del: