[V3] Make endpoints_client 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 endpoints_client use **kwargs.

Partially implements blueprint consistent-service-method-names

Change-Id: Id00c386fbf075e2fa66cdf0604c5068e65f4e344
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index e44a96b..2fd7369 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -45,8 +45,10 @@
             region = data_utils.rand_name('region')
             url = data_utils.rand_url()
             interface = 'public'
-            endpoint = (cls.client.create_endpoint(cls.service_id, interface,
-                        url, region=region, enabled=True))['endpoint']
+            endpoint = cls.client.create_endpoint(service_id=cls.service_id,
+                                                  interface=interface,
+                                                  url=url, region=region,
+                                                  enabled=True)['endpoint']
             cls.setup_endpoints.append(endpoint)
 
     @classmethod
@@ -73,8 +75,10 @@
         region = data_utils.rand_name('region')
         url = data_utils.rand_url()
         interface = 'public'
-        endpoint = (self.client.create_endpoint(self.service_id, interface,
-                    url, region=region, enabled=True)['endpoint'])
+        endpoint = self.client.create_endpoint(service_id=self.service_id,
+                                               interface=interface,
+                                               url=url, region=region,
+                                               enabled=True)['endpoint']
         # Asserting Create Endpoint response body
         self.assertIn('id', endpoint)
         self.assertEqual(region, endpoint['region'])
@@ -98,10 +102,11 @@
         region1 = data_utils.rand_name('region')
         url1 = data_utils.rand_url()
         interface1 = 'public'
-        endpoint_for_update =\
-            self.client.create_endpoint(self.service_id, interface1,
-                                        url1, region=region1,
-                                        enabled=True)['endpoint']
+        endpoint_for_update = (
+            self.client.create_endpoint(service_id=self.service_id,
+                                        interface=interface1,
+                                        url=url1, region=region1,
+                                        enabled=True)['endpoint'])
         self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
         # Creating service so as update endpoint with new service ID
         s_name = data_utils.rand_name('service')
@@ -116,12 +121,11 @@
         region2 = data_utils.rand_name('region')
         url2 = data_utils.rand_url()
         interface2 = 'internal'
-        endpoint = \
-            self.client.update_endpoint(endpoint_for_update['id'],
-                                        service_id=service2['id'],
-                                        interface=interface2, url=url2,
-                                        region=region2,
-                                        enabled=False)['endpoint']
+        endpoint = self.client.update_endpoint(endpoint_for_update['id'],
+                                               service_id=service2['id'],
+                                               interface=interface2,
+                                               url=url2, region=region2,
+                                               enabled=False)['endpoint']
         # Asserting if the attributes of endpoint are updated
         self.assertEqual(service2['id'], endpoint['service_id'])
         self.assertEqual(interface2, endpoint['interface'])
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 8cf853b..5aa90a5 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -57,8 +57,8 @@
         url = data_utils.rand_url()
         region = data_utils.rand_name('region')
         self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
-                          self.service_id, interface, url, region=region,
-                          force_enabled='False')
+                          service_id=self.service_id, interface=interface,
+                          url=url, region=region, enabled='False')
 
     @test.attr(type=['negative'])
     @test.idempotent_id('9c43181e-0627-484a-8c79-923e8a59598b')
@@ -68,8 +68,8 @@
         url = data_utils.rand_url()
         region = data_utils.rand_name('region')
         self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
-                          self.service_id, interface, url, region=region,
-                          force_enabled='True')
+                          service_id=self.service_id, interface=interface,
+                          url=url, region=region, enabled='True')
 
     def _assert_update_raises_bad_request(self, enabled):
 
@@ -78,13 +78,14 @@
         url1 = data_utils.rand_url()
         interface1 = 'public'
         endpoint_for_update = (
-            self.client.create_endpoint(self.service_id, interface1,
-                                        url1, region=region1,
-                                        enabled=True))['endpoint']
+            self.client.create_endpoint(service_id=self.service_id,
+                                        interface=interface1,
+                                        url=url1, region=region1,
+                                        enabled=True)['endpoint'])
         self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
 
         self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint,
-                          endpoint_for_update['id'], force_enabled=enabled)
+                          endpoint_for_update['id'], enabled=enabled)
 
     @test.attr(type=['negative'])
     @test.idempotent_id('65e41f32-5eb7-498f-a92a-a6ccacf7439a')
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index 6bdf8b3..ede5edb 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -13,6 +13,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+"""
+http://developer.openstack.org/api-ref-identity-v3.html#endpoints-v3
+"""
+
 from oslo_serialization import jsonutils as json
 
 from tempest.common import service_client
@@ -28,53 +32,25 @@
         body = json.loads(body)
         return service_client.ResponseBody(resp, body)
 
-    def create_endpoint(self, service_id, interface, url, **kwargs):
+    def create_endpoint(self, **kwargs):
         """Create endpoint.
 
-        Normally this function wouldn't allow setting values that are not
-        allowed for 'enabled'. Use `force_enabled` to set a non-boolean.
-
+        Available params: see http://developer.openstack.org/
+                              api-ref-identity-v3.html#createEndpoint
         """
-        region = kwargs.get('region', None)
-        if 'force_enabled' in kwargs:
-            enabled = kwargs.get('force_enabled', None)
-        else:
-            enabled = kwargs.get('enabled', None)
-        post_body = {
-            'service_id': service_id,
-            'interface': interface,
-            'url': url,
-            'region': region,
-            'enabled': enabled
-        }
-        post_body = json.dumps({'endpoint': post_body})
+        post_body = json.dumps({'endpoint': kwargs})
         resp, body = self.post('endpoints', post_body)
         self.expected_success(201, resp.status)
         body = json.loads(body)
         return service_client.ResponseBody(resp, body)
 
-    def update_endpoint(self, endpoint_id, service_id=None, interface=None,
-                        url=None, region=None, enabled=None, **kwargs):
+    def update_endpoint(self, endpoint_id, **kwargs):
         """Updates an endpoint with given parameters.
 
-        Normally this function wouldn't allow setting values that are not
-        allowed for 'enabled'. Use `force_enabled` to set a non-boolean.
-
+        Available params: see http://developer.openstack.org/
+                              api-ref-identity-v3.html#updateEndpoint
         """
-        post_body = {}
-        if service_id is not None:
-            post_body['service_id'] = service_id
-        if interface is not None:
-            post_body['interface'] = interface
-        if url is not None:
-            post_body['url'] = url
-        if region is not None:
-            post_body['region'] = region
-        if 'force_enabled' in kwargs:
-            post_body['enabled'] = kwargs['force_enabled']
-        elif enabled is not None:
-            post_body['enabled'] = enabled
-        post_body = json.dumps({'endpoint': post_body})
+        post_body = json.dumps({'endpoint': kwargs})
         resp, body = self.patch('endpoints/%s' % endpoint_id, post_body)
         self.expected_success(200, resp.status)
         body = json.loads(body)