Update service test case - V3
Adds a test_services.py test script so as to validate the update
service. And the rescpective support methods to "service_client.py"
in both json and xml interfaces
Change-Id: Ic088861049a2642076bbca166c84f234dfb6a290
Implements: blueprint keystone-v3-service-api-test
diff --git a/tempest/tests/identity/admin/v3/test_services.py b/tempest/tests/identity/admin/v3/test_services.py
new file mode 100644
index 0000000..fef3bca
--- /dev/null
+++ b/tempest/tests/identity/admin/v3/test_services.py
@@ -0,0 +1,56 @@
+#vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from tempest.common.utils.data_utils import rand_name
+from tempest.tests.identity import base
+
+
+class ServicesTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
+
+ def test_update_service(self):
+ # Update description attribute of service
+ name = rand_name('service-')
+ type = rand_name('type--')
+ description = rand_name('description-')
+ resp, body = self.client.create_service(
+ name, type, description=description)
+ self.assertEqual('200', resp['status'])
+ #Deleting the service created in this method
+ self.addCleanup(self.client.delete_service, body['id'])
+
+ s_id = body['id']
+ resp1_desc = body['description']
+
+ s_desc2 = rand_name('desc2-')
+ resp, body = self.service_client.update_service(
+ s_id, description=s_desc2)
+ resp2_desc = body['description']
+ self.assertEqual('200', resp['status'])
+ self.assertNotEqual(resp1_desc, resp2_desc)
+
+ #Get service
+ resp, body = self.client.get_service(s_id)
+ resp3_desc = body['description']
+
+ self.assertNotEqual(resp1_desc, resp3_desc)
+ self.assertEqual(resp2_desc, resp3_desc)
+
+
+class ServicesTestXML(ServicesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py
index 718b74f..6980425 100644
--- a/tempest/tests/identity/base.py
+++ b/tempest/tests/identity/base.py
@@ -30,6 +30,7 @@
cls.token_client = os.token_client
cls.endpoints_client = os.endpoints_client
cls.v3_client = os.identity_v3_client
+ cls.service_client = os.service_client
if not cls.client.has_admin_extensions():
raise cls.skipException("Admin extensions disabled")