blob: e52c4157f3b237a67657ba1cf299b0c92aea5603 [file] [log] [blame]
Brant Knudsonc7ca3342013-03-28 21:08:50 -05001# 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
16import testtools
17
Tal Kammer8e09b0d2013-06-06 19:09:03 +030018from tempest.api.compute import base
Brant Knudsonc7ca3342013-03-28 21:08:50 -050019import tempest.config as config
Brant Knudsonc7ca3342013-03-28 21:08:50 -050020
Sean Dague86bd8422013-12-20 09:56:44 -050021CONF = config.CONF
22
Brant Knudsonc7ca3342013-03-28 21:08:50 -050023
ivan-zhuf2b00502013-10-18 10:06:52 +080024class AuthTokenTestJSON(base.BaseV2ComputeTest):
Brant Knudsonc7ca3342013-03-28 21:08:50 -050025 _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 Dague86bd8422013-12-20 09:56:44 -050042 @testtools.skipIf(not CONF.identity.uri_v3,
Brant Knudsonc7ca3342013-03-28 21:08:50 -050043 '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
53class AuthTokenTestXML(AuthTokenTestJSON):
54 _interface = 'xml'