blob: f6078dad05105c2eb9976999dc5cf47bf46bec1a [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
Matthew Treinish5c660ab2014-05-18 21:14:36 -040019from tempest import test
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
Matthew Treinish5c660ab2014-05-18 21:14:36 -040025 @test.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-')
David Kranze9d2f422014-07-02 13:57:41 -040031 _, body = self.service_client.create_service(name, serv_type,
32 description=desc)
Attila Fazekasf7f34f92013-08-01 17:01:44 +020033 # Deleting the service created in this method
Matthew Treinishdb2c5972014-01-31 22:18:59 +000034 self.addCleanup(self.service_client.delete_service, body['id'])
harika-vakadia92dd742013-02-19 20:41:22 +053035
36 s_id = body['id']
37 resp1_desc = body['description']
38
Masayuki Igawa259c1132013-10-31 17:48:44 +090039 s_desc2 = data_utils.rand_name('desc2-')
David Kranze9d2f422014-07-02 13:57:41 -040040 _, body = self.service_client.update_service(
harika-vakadia92dd742013-02-19 20:41:22 +053041 s_id, description=s_desc2)
42 resp2_desc = body['description']
harika-vakadia92dd742013-02-19 20:41:22 +053043 self.assertNotEqual(resp1_desc, resp2_desc)
44
Attila Fazekasf7f34f92013-08-01 17:01:44 +020045 # Get service
David Kranze9d2f422014-07-02 13:57:41 -040046 _, body = self.service_client.get_service(s_id)
harika-vakadia92dd742013-02-19 20:41:22 +053047 resp3_desc = body['description']
48
49 self.assertNotEqual(resp1_desc, resp3_desc)
50 self.assertEqual(resp2_desc, resp3_desc)
51
52
53class ServicesTestXML(ServicesTestJSON):
54 _interface = 'xml'