blob: bfa0d847e6889650ea257c9830e018799803a93a [file] [log] [blame]
Attila Fazekasf7f34f92013-08-01 17:01:44 +02001# vim: tabstop=4 shiftwidth=4 softtabstop=4
harika-vakadia92dd742013-02-19 20:41:22 +05302
3# Copyright 2013 OpenStack Foundation
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18
Sean Dague1937d092013-05-17 16:36:38 -040019from tempest.api.identity import base
harika-vakadia92dd742013-02-19 20:41:22 +053020from tempest.common.utils.data_utils import rand_name
Giampaolo Lauriaea294952013-05-15 08:52:04 -040021from tempest.test import attr
harika-vakadia92dd742013-02-19 20:41:22 +053022
23
24class ServicesTestJSON(base.BaseIdentityAdminTest):
25 _interface = 'json'
26
Giampaolo Lauriaea294952013-05-15 08:52:04 -040027 @attr(type='gate')
harika-vakadia92dd742013-02-19 20:41:22 +053028 def test_update_service(self):
29 # Update description attribute of service
30 name = rand_name('service-')
31 type = rand_name('type--')
32 description = rand_name('description-')
33 resp, body = self.client.create_service(
34 name, type, description=description)
35 self.assertEqual('200', resp['status'])
Attila Fazekasf7f34f92013-08-01 17:01:44 +020036 # Deleting the service created in this method
harika-vakadia92dd742013-02-19 20:41:22 +053037 self.addCleanup(self.client.delete_service, body['id'])
38
39 s_id = body['id']
40 resp1_desc = body['description']
41
42 s_desc2 = rand_name('desc2-')
43 resp, body = self.service_client.update_service(
44 s_id, description=s_desc2)
45 resp2_desc = body['description']
46 self.assertEqual('200', resp['status'])
47 self.assertNotEqual(resp1_desc, resp2_desc)
48
Attila Fazekasf7f34f92013-08-01 17:01:44 +020049 # Get service
harika-vakadia92dd742013-02-19 20:41:22 +053050 resp, body = self.client.get_service(s_id)
51 resp3_desc = body['description']
52
53 self.assertNotEqual(resp1_desc, resp3_desc)
54 self.assertEqual(resp2_desc, resp3_desc)
55
56
57class ServicesTestXML(ServicesTestJSON):
58 _interface = 'xml'