summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/identity/v3/fakes.py
diff options
context:
space:
mode:
authorColleen Murphy <colleen.murphy@suse.de>2019-08-21 17:38:29 -0700
committerColleen Murphy <colleen.murphy@suse.com>2020-01-17 11:14:51 -0800
commit70ab3f9dd56a638cdff516ca85baa5ebd64c888b (patch)
treed8a92201238b7bcc749c80bb2d8a403f3d3b2d1b /openstackclient/tests/unit/identity/v3/fakes.py
parentdb29e28b7c1a6ef737f0c4cd459906379f59b252 (diff)
downloadpython-openstackclient-70ab3f9dd56a638cdff516ca85baa5ebd64c888b.tar.gz
Add support for app cred access rules
This commit introduces the --access-rules option for 'application credential create' as well as new 'access rule' commands for listing, showing, and deleting access rules. bp whitelist-extension-for-app-creds Change-Id: I04834b2874ec2a70da456a380b5bef03a392effa
Diffstat (limited to 'openstackclient/tests/unit/identity/v3/fakes.py')
-rw-r--r--openstackclient/tests/unit/identity/v3/fakes.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/openstackclient/tests/unit/identity/v3/fakes.py b/openstackclient/tests/unit/identity/v3/fakes.py
index c394ab82..fc4a48e3 100644
--- a/openstackclient/tests/unit/identity/v3/fakes.py
+++ b/openstackclient/tests/unit/identity/v3/fakes.py
@@ -470,6 +470,14 @@ app_cred_description = 'app credential for testing'
app_cred_expires = datetime.datetime(2022, 1, 1, 0, 0)
app_cred_expires_str = app_cred_expires.strftime('%Y-%m-%dT%H:%M:%S%z')
app_cred_secret = 'moresecuresecret'
+app_cred_access_rules = (
+ '[{"path": "/v2.1/servers", "method": "GET", "service": "compute"}]'
+)
+app_cred_access_rules_path = '/tmp/access_rules.json'
+access_rule_id = 'access-rule-id'
+access_rule_service = 'compute'
+access_rule_path = '/v2.1/servers'
+access_rule_method = 'GET'
APP_CRED_BASIC = {
'id': app_cred_id,
'name': app_cred_name,
@@ -478,7 +486,8 @@ APP_CRED_BASIC = {
'description': None,
'expires_at': None,
'unrestricted': False,
- 'secret': app_cred_secret
+ 'secret': app_cred_secret,
+ 'access_rules': None
}
APP_CRED_OPTIONS = {
'id': app_cred_id,
@@ -488,7 +497,25 @@ APP_CRED_OPTIONS = {
'description': app_cred_description,
'expires_at': app_cred_expires_str,
'unrestricted': False,
- 'secret': app_cred_secret
+ 'secret': app_cred_secret,
+ 'access_rules': None,
+}
+ACCESS_RULE = {
+ 'id': access_rule_id,
+ 'service': access_rule_service,
+ 'path': access_rule_path,
+ 'method': access_rule_method,
+}
+APP_CRED_ACCESS_RULES = {
+ 'id': app_cred_id,
+ 'name': app_cred_name,
+ 'project_id': project_id,
+ 'roles': app_cred_role,
+ 'description': None,
+ 'expires_at': None,
+ 'unrestricted': False,
+ 'secret': app_cred_secret,
+ 'access_rules': app_cred_access_rules
}
registered_limit_id = 'registered-limit-id'
@@ -625,6 +652,8 @@ class FakeIdentityv3Client(object):
self.application_credentials = mock.Mock()
self.application_credentials.resource_class = fakes.FakeResource(None,
{})
+ self.access_rules = mock.Mock()
+ self.access_rules.resource_class = fakes.FakeResource(None, {})
self.inference_rules = mock.Mock()
self.inference_rules.resource_class = fakes.FakeResource(None, {})
self.registered_limits = mock.Mock()