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 |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 19 | from tempest import test |
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 | |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 25 | @test.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-') |
David Kranz | e9d2f42 | 2014-07-02 13:57:41 -0400 | [diff] [blame] | 31 | _, body = self.service_client.create_service(name, serv_type, |
| 32 | description=desc) |
Attila Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 33 | # Deleting the service created in this method |
Matthew Treinish | db2c597 | 2014-01-31 22:18:59 +0000 | [diff] [blame] | 34 | self.addCleanup(self.service_client.delete_service, body['id']) |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 35 | |
| 36 | s_id = body['id'] |
| 37 | resp1_desc = body['description'] |
| 38 | |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 39 | s_desc2 = data_utils.rand_name('desc2-') |
David Kranz | e9d2f42 | 2014-07-02 13:57:41 -0400 | [diff] [blame] | 40 | _, body = self.service_client.update_service( |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 41 | s_id, description=s_desc2) |
| 42 | resp2_desc = body['description'] |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 43 | self.assertNotEqual(resp1_desc, resp2_desc) |
| 44 | |
Attila Fazekas | f7f34f9 | 2013-08-01 17:01:44 +0200 | [diff] [blame] | 45 | # Get service |
David Kranz | e9d2f42 | 2014-07-02 13:57:41 -0400 | [diff] [blame] | 46 | _, body = self.service_client.get_service(s_id) |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 47 | resp3_desc = body['description'] |
| 48 | |
| 49 | self.assertNotEqual(resp1_desc, resp3_desc) |
| 50 | self.assertEqual(resp2_desc, resp3_desc) |
| 51 | |
| 52 | |
| 53 | class ServicesTestXML(ServicesTestJSON): |
| 54 | _interface = 'xml' |