Attila Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 2 | |
| 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 Dague | 1937d09 | 2013-05-17 16:36:38 -0400 | [diff] [blame] | 19 | from tempest.api.identity import base |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 20 | from tempest.common.utils.data_utils import rand_name |
Giampaolo Lauria | ea29495 | 2013-05-15 08:52:04 -0400 | [diff] [blame] | 21 | from tempest.test import attr |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 22 | |
| 23 | |
| 24 | class ServicesTestJSON(base.BaseIdentityAdminTest): |
| 25 | _interface = 'json' |
| 26 | |
Giampaolo Lauria | ea29495 | 2013-05-15 08:52:04 -0400 | [diff] [blame] | 27 | @attr(type='gate') |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 28 | 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 Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 36 | # Deleting the service created in this method |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 37 | 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 Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 49 | # Get service |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 50 | 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 | |
| 57 | class ServicesTestXML(ServicesTestJSON): |
| 58 | _interface = 'xml' |