blob: 00f2d39380e7afcef4d942e79b8a6fd189681b6e [file] [log] [blame]
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +01001# Copyright 2015 Hewlett-Packard Development Company, L.P.
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
15from tempest.common import credentials_factory as credentials
16from tempest import config
17from tempest import exceptions
Matthew Treinishffad78a2016-04-16 14:39:52 -040018from tempest.tests import base
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +010019from tempest.tests import fake_config
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +010020
21
22class TestLegacyCredentialsProvider(base.TestCase):
23
24 fixed_params = {'identity_version': 'v2'}
25
26 def setUp(self):
27 super(TestLegacyCredentialsProvider, self).setUp()
28 self.useFixture(fake_config.ConfigFixture())
Jordan Pittier0021c292016-03-29 21:33:34 +020029 self.patchobject(config, 'TempestConfigPrivate',
30 fake_config.FakePrivate)
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +010031
32 def test_get_creds_roles_legacy_invalid(self):
33 test_accounts_class = credentials.LegacyCredentialProvider(
34 **self.fixed_params)
35 self.assertRaises(exceptions.InvalidConfiguration,
36 test_accounts_class.get_creds_by_roles,
37 ['fake_role'])