Merge "Rename references to compute security groups client"
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index 98ff64b..bb73318 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -19,8 +19,8 @@
@test.idempotent_id('5934c6ea-27dc-4d6e-9421-eeb5e045494a')
def test_image_share_accept(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -40,8 +40,8 @@
@test.idempotent_id('d9e83e5f-3524-4b38-a900-22abcb26e90e')
def test_image_share_reject(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -54,8 +54,8 @@
@test.idempotent_id('a6ee18b9-4378-465e-9ad9-9a6de58a3287')
def test_get_image_member(self):
image_id = self._create_image()
- self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
status='accepted')
@@ -70,8 +70,8 @@
@test.idempotent_id('72989bc7-2268-48ed-af22-8821e835c914')
def test_remove_image_member(self):
image_id = self._create_image()
- self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
status='accepted')
@@ -93,8 +93,8 @@
@test.idempotent_id('cb961424-3f68-4d21-8e36-30ad66fb6bfb')
def test_get_private_image(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index d5ea291..eb90719 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -22,8 +22,8 @@
@test.idempotent_id('b79efb37-820d-4cf0-b54c-308b00cf842c')
def test_image_share_invalid_status(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(lib_exc.BadRequest,
self.alt_img_client.update_image_member,
@@ -34,8 +34,8 @@
@test.idempotent_id('27002f74-109e-4a37-acd0-f91cd4597967')
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(lib_exc.Forbidden,
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 6692594..2b7ee45 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -39,9 +39,8 @@
@test.idempotent_id('63a3e1ca-37ee-4983-826d-83276a370d25')
def test_get_service_by_service_binary_name(self):
- params = {'binary': self.binary_name}
- services = (self.admin_volume_services_client.list_services(params)
- ['services'])
+ services = (self.admin_volume_services_client.list_services(
+ binary=self.binary_name)['services'])
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(self.binary_name, service['binary'])
@@ -50,10 +49,9 @@
def test_get_service_by_host_name(self):
services_on_host = [service for service in self.services if
service['host'] == self.host_name]
- params = {'host': self.host_name}
- services = (self.admin_volume_services_client.list_services(params)
- ['services'])
+ services = (self.admin_volume_services_client.list_services(
+ host=self.host_name)['services'])
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -65,10 +63,10 @@
@test.idempotent_id('ffa6167c-4497-4944-a464-226bbdb53908')
def test_get_service_by_service_and_host_name(self):
- params = {'host': self.host_name, 'binary': self.binary_name}
- services = (self.admin_volume_services_client.list_services(params)
- ['services'])
+ services = (self.admin_volume_services_client.list_services(
+ host=self.host_name, binary=self.binary_name))['services']
+
self.assertEqual(1, len(services))
self.assertEqual(self.host_name, services[0]['host'])
self.assertEqual(self.binary_name, services[0]['binary'])
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 0399413..ed34a9b 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -48,7 +48,7 @@
# Create backup
backup_name = data_utils.rand_name('Backup')
create_backup = self.backups_adm_client.create_backup
- backup = create_backup(self.volume['id'],
+ backup = create_backup(volume_id=self.volume['id'],
name=backup_name)['backup']
self.addCleanup(self.backups_adm_client.delete_backup,
backup['id'])
@@ -85,9 +85,8 @@
def test_volume_backup_export_import(self):
# Create backup
backup_name = data_utils.rand_name('Backup')
- backup = (self.backups_adm_client.create_backup(self.volume['id'],
- name=backup_name)
- ['backup'])
+ backup = (self.backups_adm_client.create_backup(
+ volume_id=self.volume['id'], name=backup_name)['backup'])
self.addCleanup(self._delete_backup, backup['id'])
self.assertEqual(backup_name, backup['name'])
self.backups_adm_client.wait_for_backup_status(backup['id'],
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index c71a193..aa9e6c6 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -32,7 +32,10 @@
self.enable_instance_password = enable_instance_password
def create_server(self, **kwargs):
- """Create server
+ """Create server.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#createServer
Most parameters except the following are passed to the API without
any changes.
@@ -69,7 +72,10 @@
return service_client.ResponseBody(resp, body)
def update_server(self, server_id, **kwargs):
- """Update server
+ """Update server.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#updateServer
Most parameters except the following are passed to the API without
any changes.
@@ -85,20 +91,26 @@
return service_client.ResponseBody(resp, body)
def show_server(self, server_id):
- """Get server details"""
+ """Get server details."""
resp, body = self.get("servers/%s" % server_id)
body = json.loads(body)
self.validate_response(schema.get_server, resp, body)
return service_client.ResponseBody(resp, body)
def delete_server(self, server_id):
- """Delete server"""
+ """Delete server."""
resp, body = self.delete("servers/%s" % server_id)
self.validate_response(schema.delete_server, resp, body)
return service_client.ResponseBody(resp, body)
def list_servers(self, detail=False, **params):
- """List servers"""
+ """List servers.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#listServers
+ and http://developer.openstack.org/
+ api-ref-compute-v2.1.html#listDetailServers
+ """
url = 'servers'
_schema = schema.list_servers
diff --git a/tempest/services/image/v2/json/images_client.py b/tempest/services/image/v2/json/images_client.py
index 33bfcb8..44062ea 100644
--- a/tempest/services/image/v2/json/images_client.py
+++ b/tempest/services/image/v2/json/images_client.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import jsonschema
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc
@@ -49,14 +48,6 @@
insecure=self.dscv,
ca_certs=self.ca_certs)
- def _validate_schema(self, body, type='image'):
- if type in ['image', 'images']:
- schema = self.show_schema(type)
- else:
- raise ValueError("%s is not a valid schema type" % type)
-
- jsonschema.validate(body, schema)
-
@property
def http(self):
if self._http is None:
@@ -65,8 +56,6 @@
def update_image(self, image_id, patch):
data = json.dumps(patch)
- self._validate_schema(data)
-
headers = {"Content-Type": "application/openstack-images-v2.0"
"-json-patch"}
resp, body = self.patch('v2/images/%s' % image_id, data, headers)
@@ -89,8 +78,6 @@
params[option] = value
data = json.dumps(params)
- self._validate_schema(data)
-
resp, body = self.post('v2/images', data)
self.expected_success(201, resp.status)
body = json.loads(body)
@@ -123,7 +110,6 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- self._validate_schema(body, type='images')
return service_client.ResponseBody(resp, body)
def show_image(self, image_id):
@@ -178,7 +164,12 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def add_image_member(self, image_id, **kwargs):
+ def create_image_member(self, image_id, **kwargs):
+ """Create an image member.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#createImageMember-v2
+ """
url = 'v2/images/%s/members' % image_id
data = json.dumps(kwargs)
resp, body = self.post(url, data)
@@ -232,8 +223,6 @@
api-ref-image-v2.html#createNamespace-v2
"""
data = json.dumps(kwargs)
- self._validate_schema(data)
-
resp, body = self.post('/v2/metadefs/namespaces', data)
self.expected_success(201, resp.status)
body = json.loads(body)
@@ -257,7 +246,6 @@
params = {'namespace': namespace}
params.update(kwargs)
data = json.dumps(params)
- self._validate_schema(data)
url = '/v2/metadefs/namespaces/%s' % namespace
resp, body = self.put(url, body=data)
self.expected_success(200, resp.status)
diff --git a/tempest/services/volume/base/admin/base_services_client.py b/tempest/services/volume/base/admin/base_services_client.py
index 68f852f..3626469 100644
--- a/tempest/services/volume/base/admin/base_services_client.py
+++ b/tempest/services/volume/base/admin/base_services_client.py
@@ -21,7 +21,7 @@
class BaseServicesClient(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/volume/base/base_backups_client.py b/tempest/services/volume/base/base_backups_client.py
index be926e6..fc9a40a 100644
--- a/tempest/services/volume/base/base_backups_client.py
+++ b/tempest/services/volume/base/base_backups_client.py
@@ -25,26 +25,17 @@
class BaseBackupsClient(service_client.ServiceClient):
"""Client class to send CRUD Volume backup API requests"""
- def create_backup(self, volume_id, container=None, name=None,
- description=None):
+ def create_backup(self, **kwargs):
"""Creates a backup of volume."""
- post_body = {'volume_id': volume_id}
- if container:
- post_body['container'] = container
- if name:
- post_body['name'] = name
- if description:
- post_body['description'] = description
- post_body = json.dumps({'backup': post_body})
+ post_body = json.dumps({'backup': kwargs})
resp, body = self.post('backups', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body)
- def restore_backup(self, backup_id, volume_id=None):
+ def restore_backup(self, backup_id, **kwargs):
"""Restore volume from backup."""
- post_body = {'volume_id': volume_id}
- post_body = json.dumps({'restore': post_body})
+ post_body = json.dumps({'restore': kwargs})
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
@@ -82,11 +73,9 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
- def import_backup(self, backup_service, backup_url):
+ def import_backup(self, **kwargs):
"""Import backup metadata record."""
- post_body = {'backup_service': backup_service,
- 'backup_url': backup_url}
- post_body = json.dumps({'backup-record': post_body})
+ post_body = json.dumps({'backup-record': kwargs})
resp, body = self.post("backups/import_record", post_body)
body = json.loads(body)
self.expected_success(201, resp.status)
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index ed886da..db9db34 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -123,9 +123,9 @@
def test_get_connection_kwargs_default_for_https(self):
kwargs = self.client._get_connection_kwargs('https')
self.assertEqual(600, kwargs['timeout'])
- self.assertEqual(None, kwargs['ca_certs'])
- self.assertEqual(None, kwargs['cert_file'])
- self.assertEqual(None, kwargs['key_file'])
+ self.assertIsNone(kwargs['ca_certs'])
+ self.assertIsNone(kwargs['cert_file'])
+ self.assertIsNone(kwargs['key_file'])
self.assertEqual(False, kwargs['insecure'])
self.assertEqual(True, kwargs['ssl_compression'])
self.assertEqual(6, len(kwargs.keys()))
diff --git a/tox.ini b/tox.ini
index 41eece1..fedd04c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = pep8,py27,py34
+envlist = pep8,py34,py27
minversion = 1.6
skipsdist = True