blob: ffeede8afdb6593edfc2dcc950992f387f707f30 [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
21
ivan-zhuf2b00502013-10-18 10:06:52 +080022class AuthTokenTestJSON(base.BaseV2ComputeTest):
Brant Knudsonc7ca3342013-03-28 21:08:50 -050023 _interface = 'json'
24
25 @classmethod
26 def setUpClass(cls):
27 super(AuthTokenTestJSON, cls).setUpClass()
28
29 cls.servers_v2 = cls.os.servers_client
30 cls.servers_v3 = cls.os.servers_client_v3_auth
31
32 def test_v2_token(self):
33 # Can get a token using v2 of the identity API and use that to perform
34 # an operation on the compute service.
35
36 # Doesn't matter which compute API is used,
37 # picking list_servers because it's easy.
38 self.servers_v2.list_servers()
39
40 @testtools.skipIf(not config.TempestConfig().identity.uri_v3,
41 'v3 auth client not configured')
42 def test_v3_token(self):
43 # Can get a token using v3 of the identity API and use that to perform
44 # an operation on the compute service.
45
46 # Doesn't matter which compute API is used,
47 # picking list_servers because it's easy.
48 self.servers_v3.list_servers()
49
50
51class AuthTokenTestXML(AuthTokenTestJSON):
52 _interface = 'xml'