Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 1 | # Copyright 2013 IBM Corp |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | |
| 16 | import testtools |
| 17 | |
Tal Kammer | 8e09b0d | 2013-06-06 19:09:03 +0300 | [diff] [blame] | 18 | from tempest.api.compute import base |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 19 | import tempest.config as config |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 20 | |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 21 | CONF = config.CONF |
| 22 | |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 23 | |
ivan-zhu | f2b0050 | 2013-10-18 10:06:52 +0800 | [diff] [blame] | 24 | class AuthTokenTestJSON(base.BaseV2ComputeTest): |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 25 | _interface = 'json' |
| 26 | |
| 27 | @classmethod |
| 28 | def setUpClass(cls): |
| 29 | super(AuthTokenTestJSON, cls).setUpClass() |
| 30 | |
| 31 | cls.servers_v2 = cls.os.servers_client |
| 32 | cls.servers_v3 = cls.os.servers_client_v3_auth |
| 33 | |
| 34 | def test_v2_token(self): |
| 35 | # Can get a token using v2 of the identity API and use that to perform |
| 36 | # an operation on the compute service. |
| 37 | |
| 38 | # Doesn't matter which compute API is used, |
| 39 | # picking list_servers because it's easy. |
| 40 | self.servers_v2.list_servers() |
| 41 | |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 42 | @testtools.skipIf(not CONF.identity.uri_v3, |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 43 | 'v3 auth client not configured') |
| 44 | def test_v3_token(self): |
| 45 | # Can get a token using v3 of the identity API and use that to perform |
| 46 | # an operation on the compute service. |
| 47 | |
| 48 | # Doesn't matter which compute API is used, |
| 49 | # picking list_servers because it's easy. |
| 50 | self.servers_v3.list_servers() |
| 51 | |
| 52 | |
| 53 | class AuthTokenTestXML(AuthTokenTestJSON): |
| 54 | _interface = 'xml' |