Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 1 | # Copyright 2014 Hewlett-Packard Development Company, L.P. |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
| 16 | from tempest.lib import auth |
| 17 | |
| 18 | |
| 19 | class FakeCredentials(auth.Credentials): |
| 20 | |
| 21 | def is_valid(self): |
| 22 | return True |
| 23 | |
| 24 | |
| 25 | class FakeKeystoneV2Credentials(auth.KeystoneV2Credentials): |
| 26 | |
| 27 | def __init__(self): |
| 28 | creds = dict( |
| 29 | username='fake_username', |
| 30 | password='fake_password', |
| 31 | tenant_name='fake_tenant_name' |
| 32 | ) |
| 33 | super(FakeKeystoneV2Credentials, self).__init__(**creds) |
| 34 | |
| 35 | |
| 36 | class FakeKeystoneV3Credentials(auth.KeystoneV3Credentials): |
| 37 | """Fake credentials suitable for the Keystone Identity V3 API""" |
| 38 | |
| 39 | def __init__(self): |
| 40 | creds = dict( |
| 41 | username='fake_username', |
| 42 | password='fake_password', |
| 43 | user_domain_name='fake_domain_name', |
| 44 | project_name='fake_tenant_name', |
| 45 | project_domain_name='fake_domain_name' |
| 46 | ) |
| 47 | super(FakeKeystoneV3Credentials, self).__init__(**creds) |
| 48 | |
| 49 | |
| 50 | class FakeKeystoneV3DomainCredentials(auth.KeystoneV3Credentials): |
| 51 | """Fake credentials for the Keystone Identity V3 API, with no scope""" |
| 52 | |
| 53 | def __init__(self): |
| 54 | creds = dict( |
| 55 | username='fake_username', |
| 56 | password='fake_password', |
| 57 | user_domain_name='fake_domain_name' |
| 58 | ) |
| 59 | super(FakeKeystoneV3DomainCredentials, self).__init__(**creds) |
Andrea Frittoli (andreaf) | 3e82af7 | 2016-05-05 22:53:38 +0100 | [diff] [blame] | 60 | |
| 61 | |
| 62 | class FakeKeystoneV3AllCredentials(auth.KeystoneV3Credentials): |
| 63 | """Fake credentials for the Keystone Identity V3 API, with no scope""" |
| 64 | |
| 65 | def __init__(self): |
| 66 | creds = dict( |
| 67 | username='fake_username', |
| 68 | password='fake_password', |
| 69 | user_domain_name='fake_domain_name', |
| 70 | project_name='fake_tenant_name', |
| 71 | project_domain_name='fake_domain_name', |
| 72 | domain_name='fake_domain_name' |
| 73 | ) |
| 74 | super(FakeKeystoneV3AllCredentials, self).__init__(**creds) |