Make v1 create_image & update_image use **kwargs

As we discussed on
http://lists.openstack.org/pipermail/openstack-dev/2015-July/068864.html
All http POST/PUT methods need to contain **kwargs as their arguments.

This patch makes create_image and update_image of v1 image client
to use **kwargs.

Partially implements blueprint consistent-service-method-names

Change-Id: Ia03d5e8fdf7d7eac338665670b561e452a1d31d9
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index c3205ce..18d0446 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -62,18 +62,12 @@
     @classmethod
     def create_image(cls, **kwargs):
         """Wrapper that returns a test image."""
-        name = data_utils.rand_name(cls.__name__ + "-instance")
 
-        if 'name' in kwargs:
-            name = kwargs.pop('name')
+        if 'name' not in kwargs:
+            name = data_utils.rand_name(cls.__name__ + "-instance")
+            kwargs['name'] = name
 
-        container_format = kwargs.pop('container_format')
-        disk_format = kwargs.pop('disk_format')
-
-        image = cls.client.create_image(name=name,
-                                        container_format=container_format,
-                                        disk_format=disk_format,
-                                        **kwargs)
+        image = cls.client.create_image(**kwargs)
         # Image objects returned by the v1 client have the image
         # data inside a dict that is keyed against 'image'.
         if 'image' in image:
diff --git a/tempest/api/image/v1/test_images_negative.py b/tempest/api/image/v1/test_images_negative.py
index 3d94408..f16b80e 100644
--- a/tempest/api/image/v1/test_images_negative.py
+++ b/tempest/api/image/v1/test_images_negative.py
@@ -27,13 +27,17 @@
     def test_register_with_invalid_container_format(self):
         # Negative tests for invalid data supplied to POST /images
         self.assertRaises(lib_exc.BadRequest, self.client.create_image,
-                          'test', 'wrong', 'vhd')
+                          name='test',
+                          container_format='wrong',
+                          disk_format='vhd',)
 
     @test.attr(type=['negative'])
     @test.idempotent_id('993face5-921d-4e84-aabf-c1bba4234a67')
     def test_register_with_invalid_disk_format(self):
         self.assertRaises(lib_exc.BadRequest, self.client.create_image,
-                          'test', 'bare', 'wrong')
+                          name='test',
+                          container_format='bare',
+                          disk_format='wrong',)
 
     @test.attr(type=['negative'])
     @test.idempotent_id('bb016f15-0820-4f27-a92d-09b2f67d2488')
diff --git a/tempest/services/image/v1/json/images_client.py b/tempest/services/image/v1/json/images_client.py
index 3406db8..5b6a394 100644
--- a/tempest/services/image/v1/json/images_client.py
+++ b/tempest/services/image/v1/json/images_client.py
@@ -147,50 +147,29 @@
             self._http = self._get_http()
         return self._http
 
-    def create_image(self, name, container_format, disk_format, **kwargs):
-        params = {
-            "name": name,
-            "container_format": container_format,
-            "disk_format": disk_format,
-        }
-
+    def create_image(self, **kwargs):
         headers = {}
+        data = kwargs.pop('data', None)
+        headers.update(self._image_meta_to_headers(kwargs))
 
-        for option in ['is_public', 'location', 'properties',
-                       'copy_from', 'min_ram']:
-            if option in kwargs:
-                params[option] = kwargs.get(option)
-
-        headers.update(self._image_meta_to_headers(params))
-
-        if 'data' in kwargs:
-            return self._create_with_data(headers, kwargs.get('data'))
+        if data is not None:
+            return self._create_with_data(headers, data)
 
         resp, body = self.post('v1/images', None, headers)
         self.expected_success(201, resp.status)
         body = json.loads(body)
         return service_client.ResponseBody(resp, body)
 
-    def update_image(self, image_id, name=None, container_format=None,
-                     data=None, properties=None):
-        params = {}
+    def update_image(self, image_id, **kwargs):
         headers = {}
-        if name is not None:
-            params['name'] = name
-
-        if container_format is not None:
-            params['container_format'] = container_format
-
-        if properties is not None:
-            params['properties'] = properties
-
-        headers.update(self._image_meta_to_headers(params))
+        data = kwargs.pop('data', None)
+        headers.update(self._image_meta_to_headers(kwargs))
 
         if data is not None:
             return self._update_with_data(image_id, headers, data)
 
         url = 'v1/images/%s' % image_id
-        resp, body = self.put(url, data, headers)
+        resp, body = self.put(url, None, headers)
         self.expected_success(200, resp.status)
         body = json.loads(body)
         return service_client.ResponseBody(resp, body)