harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 1 | # 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 Dague | 1937d09 | 2013-05-17 16:36:38 -0400 | [diff] [blame] | 17 | from tempest.api.identity import base |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 18 | from tempest.common.utils import data_utils |
Giampaolo Lauria | ea29495 | 2013-05-15 08:52:04 -0400 | [diff] [blame] | 19 | from tempest.test import attr |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 20 | |
| 21 | |
Matthew Treinish | db2c597 | 2014-01-31 22:18:59 +0000 | [diff] [blame] | 22 | class ServicesTestJSON(base.BaseIdentityV3AdminTest): |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 23 | _interface = 'json' |
| 24 | |
Giampaolo Lauria | ea29495 | 2013-05-15 08:52:04 -0400 | [diff] [blame] | 25 | @attr(type='gate') |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 26 | def test_update_service(self): |
| 27 | # Update description attribute of service |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 28 | name = data_utils.rand_name('service-') |
Matthew Treinish | db2c597 | 2014-01-31 22:18:59 +0000 | [diff] [blame] | 29 | 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 Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 34 | # Deleting the service created in this method |
Matthew Treinish | db2c597 | 2014-01-31 22:18:59 +0000 | [diff] [blame] | 35 | self.addCleanup(self.service_client.delete_service, body['id']) |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 36 | |
| 37 | s_id = body['id'] |
| 38 | resp1_desc = body['description'] |
| 39 | |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 40 | s_desc2 = data_utils.rand_name('desc2-') |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 41 | 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 Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 47 | # Get service |
Matthew Treinish | db2c597 | 2014-01-31 22:18:59 +0000 | [diff] [blame] | 48 | resp, body = self.service_client.get_service(s_id) |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 49 | resp3_desc = body['description'] |
| 50 | |
| 51 | self.assertNotEqual(resp1_desc, resp3_desc) |
| 52 | self.assertEqual(resp2_desc, resp3_desc) |
| 53 | |
| 54 | |
| 55 | class ServicesTestXML(ServicesTestJSON): |
| 56 | _interface = 'xml' |