blob: c5d4ddff024a5162d2de699a202c0ed126e16d17 [file] [log] [blame]
harika-vakadia92dd742013-02-19 20:41:22 +05301# Copyright 2013 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16
Sean Dague1937d092013-05-17 16:36:38 -040017from tempest.api.identity import base
Masayuki Igawa259c1132013-10-31 17:48:44 +090018from tempest.common.utils import data_utils
Giampaolo Lauriaea294952013-05-15 08:52:04 -040019from tempest.test import attr
harika-vakadia92dd742013-02-19 20:41:22 +053020
21
Matthew Treinishdb2c5972014-01-31 22:18:59 +000022class ServicesTestJSON(base.BaseIdentityV3AdminTest):
harika-vakadia92dd742013-02-19 20:41:22 +053023 _interface = 'json'
24
Giampaolo Lauriaea294952013-05-15 08:52:04 -040025 @attr(type='gate')
harika-vakadia92dd742013-02-19 20:41:22 +053026 def test_update_service(self):
27 # Update description attribute of service
Masayuki Igawa259c1132013-10-31 17:48:44 +090028 name = data_utils.rand_name('service-')
Matthew Treinishdb2c5972014-01-31 22:18:59 +000029 serv_type = data_utils.rand_name('type--')
30 desc = data_utils.rand_name('description-')
31 resp, body = self.service_client.create_service(name, serv_type,
32 description=desc)
33 self.assertEqual('201', resp['status'])
Attila Fazekasf7f34f92013-08-01 17:01:44 +020034 # Deleting the service created in this method
Matthew Treinishdb2c5972014-01-31 22:18:59 +000035 self.addCleanup(self.service_client.delete_service, body['id'])
harika-vakadia92dd742013-02-19 20:41:22 +053036
37 s_id = body['id']
38 resp1_desc = body['description']
39
Masayuki Igawa259c1132013-10-31 17:48:44 +090040 s_desc2 = data_utils.rand_name('desc2-')
harika-vakadia92dd742013-02-19 20:41:22 +053041 resp, body = self.service_client.update_service(
42 s_id, description=s_desc2)
43 resp2_desc = body['description']
44 self.assertEqual('200', resp['status'])
45 self.assertNotEqual(resp1_desc, resp2_desc)
46
Attila Fazekasf7f34f92013-08-01 17:01:44 +020047 # Get service
Matthew Treinishdb2c5972014-01-31 22:18:59 +000048 resp, body = self.service_client.get_service(s_id)
harika-vakadia92dd742013-02-19 20:41:22 +053049 resp3_desc = body['description']
50
51 self.assertNotEqual(resp1_desc, resp3_desc)
52 self.assertEqual(resp2_desc, resp3_desc)
53
54
55class ServicesTestXML(ServicesTestJSON):
56 _interface = 'xml'