diff options
author | Zuul <zuul@review.opendev.org> | 2019-10-10 03:00:19 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-10-10 03:00:19 +0000 |
commit | 925c2c1fb953d9b6d699bf691bb70eae7c561103 (patch) | |
tree | 7401bf37c09fb66754e442a890dd605d5c690ad6 /keystoneclient/tests | |
parent | 79f150f962a2300f4644ba735b4f28e337035251 (diff) | |
parent | 6c116ec084620942880ef62999b65e3907c3077f (diff) | |
download | python-keystoneclient-925c2c1fb953d9b6d699bf691bb70eae7c561103.tar.gz |
Merge "Add support for app cred access rules"3.22.0
Diffstat (limited to 'keystoneclient/tests')
-rw-r--r-- | keystoneclient/tests/unit/v3/test_access_rules.py | 41 | ||||
-rw-r--r-- | keystoneclient/tests/unit/v3/test_application_credentials.py | 21 |
2 files changed, 62 insertions, 0 deletions
diff --git a/keystoneclient/tests/unit/v3/test_access_rules.py b/keystoneclient/tests/unit/v3/test_access_rules.py new file mode 100644 index 0000000..d3e22f8 --- /dev/null +++ b/keystoneclient/tests/unit/v3/test_access_rules.py @@ -0,0 +1,41 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import uuid + +from keystoneclient import exceptions +from keystoneclient.tests.unit.v3 import utils +from keystoneclient.v3 import access_rules + + +class AccessRuleTests(utils.ClientTestCase, utils.CrudTests): + def setUp(self): + super(AccessRuleTests, self).setUp() + self.key = 'access_rule' + self.collection_key = 'access_rules' + self.model = access_rules.AccessRule + self.manager = self.client.access_rules + self.path_prefix = 'users/%s' % self.TEST_USER_ID + + def new_ref(self, **kwargs): + kwargs = super(AccessRuleTests, self).new_ref(**kwargs) + kwargs.setdefault('path', uuid.uuid4().hex) + kwargs.setdefault('method', uuid.uuid4().hex) + kwargs.setdefault('service', uuid.uuid4().hex) + return kwargs + + def test_update(self): + self.assertRaises(exceptions.MethodNotImplemented, self.manager.update) + + def test_create(self): + self.assertRaises(exceptions.MethodNotImplemented, self.manager.create) diff --git a/keystoneclient/tests/unit/v3/test_application_credentials.py b/keystoneclient/tests/unit/v3/test_application_credentials.py index be3c62a..6e4bba3 100644 --- a/keystoneclient/tests/unit/v3/test_application_credentials.py +++ b/keystoneclient/tests/unit/v3/test_application_credentials.py @@ -98,6 +98,27 @@ class ApplicationCredentialTests(utils.ClientTestCase, utils.CrudTests): super(ApplicationCredentialTests, self).test_create(ref=ref, req_ref=req_ref) + def test_create_with_access_rules(self): + ref = self.new_ref(user=uuid.uuid4().hex) + access_rules = [ + { + 'method': 'GET', + 'path': '/v3/projects', + 'service': 'identity' + } + ] + ref['access_rules'] = access_rules + req_ref = ref.copy() + req_ref.pop('id') + user = req_ref.pop('user') + + self.stub_entity('POST', + ['users', user, self.collection_key], + status_code=201, entity=req_ref) + + super(ApplicationCredentialTests, self).test_create(ref=ref, + req_ref=req_ref) + def test_get(self): ref = self.new_ref(user=uuid.uuid4().hex) |