Andrea Frittoli (andreaf) | 290b3e1 | 2015-10-08 10:25:02 +0100 | [diff] [blame] | 1 | # 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 | |
| 15 | from tempest.common import credentials_factory as credentials |
| 16 | from tempest import config |
| 17 | from tempest import exceptions |
Matthew Treinish | ffad78a | 2016-04-16 14:39:52 -0400 | [diff] [blame] | 18 | from tempest.tests import base |
Andrea Frittoli (andreaf) | 290b3e1 | 2015-10-08 10:25:02 +0100 | [diff] [blame] | 19 | from tempest.tests import fake_config |
Andrea Frittoli (andreaf) | 290b3e1 | 2015-10-08 10:25:02 +0100 | [diff] [blame] | 20 | |
| 21 | |
| 22 | class 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 Pittier | 0021c29 | 2016-03-29 21:33:34 +0200 | [diff] [blame] | 29 | self.patchobject(config, 'TempestConfigPrivate', |
| 30 | fake_config.FakePrivate) |
Andrea Frittoli (andreaf) | 290b3e1 | 2015-10-08 10:25:02 +0100 | [diff] [blame] | 31 | |
| 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']) |