diff options
author | 2015-09-17 23:01:35 +0200 | |
---|---|---|
committer | 2015-09-17 23:01:35 +0200 | |
commit | c6437b44d02ee55f2c0c9f35b6aaaed13b19d89e (patch) | |
tree | fdcca56fb6ee2681fbd6e4866939a086e96a1fd8 /moonclient | |
parent | 66331623ca2f102b5cbc9ebd0c0da75b88da390c (diff) |
Add all commands for scopes and add tests for them.
Change-Id: Id6fd4755158e52aa35569579aa6d60e4a0b2b535
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/action_category_scope.py | 63 | ||||
-rw-r--r-- | moonclient/moonclient/intraextension.py | 4 | ||||
-rw-r--r-- | moonclient/moonclient/object_category_scope.py | 63 | ||||
-rw-r--r-- | moonclient/moonclient/subject_category_scope.py | 62 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_action_scopes.json | 254 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_object_scopes.json | 254 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_subject_scopes.json | 254 | ||||
-rw-r--r-- | moonclient/setup.py | 18 |
8 files changed, 880 insertions, 92 deletions
diff --git a/moonclient/moonclient/action_category_scope.py b/moonclient/moonclient/action_category_scope.py index 7eab8a10..b07c21aa 100644 --- a/moonclient/moonclient/action_category_scope.py +++ b/moonclient/moonclient/action_category_scope.py @@ -17,6 +17,11 @@ class ActionCategoryScopeList(Lister): def get_parser(self, prog_name): parser = super(ActionCategoryScopeList, self).get_parser(prog_name) parser.add_argument( + 'category', + metavar='<category-uuid>', + help='Category UUID', + ) + parser.add_argument( '--intraextension', metavar='<intraextension-uuid>', help='IntraExtension UUID', @@ -26,13 +31,13 @@ class ActionCategoryScopeList(Lister): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_category_scope".format(parsed_args.intraextension), + data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}".format( + parsed_args.intraextension, parsed_args.category), authtoken=True) - if "action_category_scope" not in data: - raise Exception("Error in command {}: {}".format("ActionCategoryScopeList", data)) + self.log.debug(data) return ( - ("action_category", "action_category_scope",), - ((_val1, str(_val2)) for _val1, _val2 in data["action_category_scope"].items()) + ("id", "name", "description"), + ((_id, data[_id]["name"], data[_id]["description"]) for _id in data) ) @@ -44,14 +49,19 @@ class ActionCategoryScopeAdd(Command): def get_parser(self, prog_name): parser = super(ActionCategoryScopeAdd, self).get_parser(prog_name) parser.add_argument( - 'action_category', - metavar='<action_category-uuid>', - help='Action UUID', + 'category', + metavar='<category-uuid>', + help='Category UUID', + ) + parser.add_argument( + 'scope_name', + metavar='<scope-str>', + help='Scope Name', ) parser.add_argument( - 'action_category_scope', - metavar='<action_category_scope-uuid>', - help='Action UUID', + '--description', + metavar='<description-str>', + help='Description', ) parser.add_argument( '--intraextension', @@ -63,17 +73,16 @@ class ActionCategoryScopeAdd(Command): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_category_scope".format(parsed_args.intraextension), + data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}".format( + parsed_args.intraextension, parsed_args.category), post_data={ - "action_category_id": parsed_args.action_category, - "action_category_scope_id": parsed_args.action_category_scope, + "action_scope_name": parsed_args.scope_name, + "action_scope_description": parsed_args.description, }, authtoken=True) - if "action_category_scope" not in data: - raise Exception("Error in command {}".format(data)) return ( - ("action_category", "action_category_scope",), - ((_val1, str(_val2)) for _val1, _val2 in data["action_category_scope"].items()) + ("id", "name", "description"), + ((_id, data[_id]["name"], data[_id]["description"]) for _id in data) ) @@ -85,14 +94,14 @@ class ActionCategoryScopeDelete(Command): def get_parser(self, prog_name): parser = super(ActionCategoryScopeDelete, self).get_parser(prog_name) parser.add_argument( - 'action_category', - metavar='<action_category-uuid>', - help='Action UUID', + 'category', + metavar='<category-uuid>', + help='Category UUID', ) parser.add_argument( - 'action_category_scope', - metavar='<action_category_scope-uuid>', - help='Action UUID', + 'scope_id', + metavar='<scope-uuid>', + help='Scope UUID', ) parser.add_argument( '--intraextension', @@ -104,10 +113,10 @@ class ActionCategoryScopeDelete(Command): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_category_scope/{}/{}".format( + self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}/{}".format( parsed_args.intraextension, - parsed_args.action_category, - parsed_args.action_category_scope + parsed_args.category, + parsed_args.scope_id ), method="DELETE", authtoken=True)
\ No newline at end of file diff --git a/moonclient/moonclient/intraextension.py b/moonclient/moonclient/intraextension.py index 6def7ece..eba6e614 100644 --- a/moonclient/moonclient/intraextension.py +++ b/moonclient/moonclient/intraextension.py @@ -29,9 +29,9 @@ class IntraExtensionSelect(Command): ie = self.app.get_url("/v3/OS-MOON/intra_extensions", authtoken=True) if parsed_args.id in ie.keys(): self.app.intraextension = parsed_args.id - self.log.info("Select {} IntraExtension.".format(self.app.intraextension)) + self.app.stdout.write("Select {} IntraExtension.\n".format(self.app.intraextension)) else: - self.log.error("IntraExtension {} unknown.".format(parsed_args.id)) + self.app.stdout.write("IntraExtension {} unknown.\n".format(parsed_args.id)) return diff --git a/moonclient/moonclient/object_category_scope.py b/moonclient/moonclient/object_category_scope.py index c404bdd0..3bd10b58 100644 --- a/moonclient/moonclient/object_category_scope.py +++ b/moonclient/moonclient/object_category_scope.py @@ -17,6 +17,11 @@ class ObjectCategoryScopeList(Lister): def get_parser(self, prog_name): parser = super(ObjectCategoryScopeList, self).get_parser(prog_name) parser.add_argument( + 'category', + metavar='<category-uuid>', + help='Category UUID', + ) + parser.add_argument( '--intraextension', metavar='<intraextension-uuid>', help='IntraExtension UUID', @@ -26,13 +31,13 @@ class ObjectCategoryScopeList(Lister): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_category_scope".format(parsed_args.intraextension), + data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}".format( + parsed_args.intraextension, parsed_args.category), authtoken=True) - if "object_category_scope" not in data: - raise Exception("Error in command {}: {}".format("ObjectCategoryScopeList", data)) + self.log.debug(data) return ( - ("object_category", "object_category_scope",), - ((_val1, str(_val2)) for _val1, _val2 in data["object_category_scope"].items()) + ("id", "name", "description"), + ((_id, data[_id]["name"], data[_id]["description"]) for _id in data) ) @@ -44,14 +49,19 @@ class ObjectCategoryScopeAdd(Command): def get_parser(self, prog_name): parser = super(ObjectCategoryScopeAdd, self).get_parser(prog_name) parser.add_argument( - 'object_category', - metavar='<object_category-uuid>', - help='Object UUID', + 'category', + metavar='<category-uuid>', + help='Category UUID', + ) + parser.add_argument( + 'scope_name', + metavar='<scope-str>', + help='Scope Name', ) parser.add_argument( - 'object_category_scope', - metavar='<object_category_scope-uuid>', - help='Object Scope UUID', + '--description', + metavar='<description-str>', + help='Description', ) parser.add_argument( '--intraextension', @@ -63,17 +73,16 @@ class ObjectCategoryScopeAdd(Command): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_category_scope".format(parsed_args.intraextension), + data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}".format( + parsed_args.intraextension, parsed_args.category), post_data={ - "object_category_id": parsed_args.object_category, - "object_category_scope_id": parsed_args.object_category_scope, + "object_scope_name": parsed_args.scope_name, + "object_scope_description": parsed_args.description, }, authtoken=True) - if "object_category_scope" not in data: - raise Exception("Error in command {}".format(data)) return ( - ("object_category", "object_category_scope",), - ((_val1, str(_val2)) for _val1, _val2 in data["object_category_scope"].items()) + ("id", "name", "description"), + ((_id, data[_id]["name"], data[_id]["description"]) for _id in data) ) @@ -85,14 +94,14 @@ class ObjectCategoryScopeDelete(Command): def get_parser(self, prog_name): parser = super(ObjectCategoryScopeDelete, self).get_parser(prog_name) parser.add_argument( - 'object_category', - metavar='<object_category-uuid>', - help='Object UUID', + 'category', + metavar='<category-uuid>', + help='Category UUID', ) parser.add_argument( - 'object_category_scope', - metavar='<object_category_scope-uuid>', - help='Object Scope UUID', + 'scope_id', + metavar='<scope-uuid>', + help='Scope UUID', ) parser.add_argument( '--intraextension', @@ -104,10 +113,10 @@ class ObjectCategoryScopeDelete(Command): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_category_scope/{}/{}".format( + self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}/{}".format( parsed_args.intraextension, - parsed_args.object_category, - parsed_args.object_category_scope + parsed_args.category, + parsed_args.scope_id ), method="DELETE", authtoken=True)
\ No newline at end of file diff --git a/moonclient/moonclient/subject_category_scope.py b/moonclient/moonclient/subject_category_scope.py index 6f99a336..e6329c25 100644 --- a/moonclient/moonclient/subject_category_scope.py +++ b/moonclient/moonclient/subject_category_scope.py @@ -17,6 +17,11 @@ class SubjectCategoryScopeList(Lister): def get_parser(self, prog_name): parser = super(SubjectCategoryScopeList, self).get_parser(prog_name) parser.add_argument( + 'category', + metavar='<category-uuid>', + help='Category UUID', + ) + parser.add_argument( '--intraextension', metavar='<intraextension-uuid>', help='IntraExtension UUID', @@ -26,13 +31,12 @@ class SubjectCategoryScopeList(Lister): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_category_scope".format(parsed_args.intraextension), + data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format( + parsed_args.intraextension, parsed_args.category), authtoken=True) - if "subject_category_scope" not in data: - raise Exception("Error in command {}: {}".format("SubjectCategoryScopeList", data)) return ( - ("subject_category", "subject_category_scope",), - ((_val1, str(_val2)) for _val1, _val2 in data["subject_category_scope"].items()) + ("id", "name", "description"), + ((_id, data[_id]["name"], data[_id]["description"]) for _id in data) ) @@ -44,14 +48,19 @@ class SubjectCategoryScopeAdd(Command): def get_parser(self, prog_name): parser = super(SubjectCategoryScopeAdd, self).get_parser(prog_name) parser.add_argument( - 'subject_category', - metavar='<subject_category-uuid>', - help='Subject UUID', + 'category', + metavar='<category-uuid>', + help='Category UUID', + ) + parser.add_argument( + 'scope_name', + metavar='<scope-str>', + help='Scope Name', ) parser.add_argument( - 'subject_category_scope', - metavar='<subject_category_scope-uuid>', - help='Subject UUID', + '--description', + metavar='<description-str>', + help='Description', ) parser.add_argument( '--intraextension', @@ -63,17 +72,16 @@ class SubjectCategoryScopeAdd(Command): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_category_scope".format(parsed_args.intraextension), + data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format( + parsed_args.intraextension, parsed_args.category), post_data={ - "subject_category_id": parsed_args.subject_category, - "subject_category_scope_id": parsed_args.subject_category_scope, + "subject_scope_name": parsed_args.scope_name, + "subject_scope_description": parsed_args.description, }, authtoken=True) - if "subject_category_scope" not in data: - raise Exception("Error in command {}".format(data)) return ( - ("subject_category", "subject_category_scope",), - ((_val1, str(_val2)) for _val1, _val2 in data["subject_category_scope"].items()) + ("id", "name", "description"), + ((_id, data[_id]["name"], data[_id]["description"]) for _id in data) ) @@ -85,14 +93,14 @@ class SubjectCategoryScopeDelete(Command): def get_parser(self, prog_name): parser = super(SubjectCategoryScopeDelete, self).get_parser(prog_name) parser.add_argument( - 'subject_category', - metavar='<subject_category-uuid>', - help='Subject UUID', + 'category', + metavar='<category-uuid>', + help='Category UUID', ) parser.add_argument( - 'subject_category_scope', - metavar='<subject_category_scope-uuid>', - help='Subject UUID', + 'scope_id', + metavar='<scope-uuid>', + help='Scope UUID', ) parser.add_argument( '--intraextension', @@ -104,10 +112,10 @@ class SubjectCategoryScopeDelete(Command): def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension - self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_category_scope/{}/{}".format( + self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}/{}".format( parsed_args.intraextension, - parsed_args.subject_category, - parsed_args.subject_category_scope + parsed_args.category, + parsed_args.scope_id ), method="DELETE", authtoken=True)
\ No newline at end of file diff --git a/moonclient/moonclient/tests/tests_action_scopes.json b/moonclient/moonclient/tests/tests_action_scopes.json new file mode 100644 index 00000000..5cba922b --- /dev/null +++ b/moonclient/moonclient/tests/tests_action_scopes.json @@ -0,0 +1,254 @@ +{ + "command_options": "-f value", + "tests_group": { + "authz": [ + { + "name": "list tenant", + "command": "tenant list", + "result": "(?!alt_demo)", + "description": "Check if tenant alt_demo is used." + }, + { + "name": "add tenant alt_demo", + "command": "tenant add alt_demo", + "result": "^$", + "description": "Add a new tenant", + "command_options": "" + }, + { + "name": "check tenant alt_demo", + "command": "tenant list", + "result": "(?P<uuid>\\w+)\\s+alt_demo", + "description": "Check that tenant alt_demo has been correctly added" + }, + { + "name": "create_intraextension_authz", + "command": "intraextension create --policy_model policy_authz authz_test", + "result": "IntraExtension created: (?P<uuid_authz>\\w+)", + "description": "Create an authz intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_authz", + "command": "intraextension list", + "result": "$uuid_authz", + "description": "Check the existence of that authz intra extension" + }, + { + "name": "set_tenant_authz", + "command": "tenant set --authz $uuid_authz $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant alt_demo", + "command_options": "" + }, + { + "name": "select_authz_ie", + "command": "intraextension select $uuid_authz", + "result": "Select $uuid_authz IntraExtension.", + "description": "Select the authz IntraExtension", + "command_options": "" + }, + { + "name": "check_select_authz_ie", + "command": "intraextension show selected", + "result": "$uuid_authz", + "description": "Check the selected authz IntraExtension", + "command_options": "-c id -f value" + }, + { + "name": "get_one_action_category", + "command": "action category list", + "result": "(?P<uuid_action_category>\\w+)\\s+resource_action", + "description": "Get one action_category for next tests.", + "command_options": "-c id -c name -f value" + }, + { + "name": "add_scope", + "command": "action scope add $uuid_action_category testers --description \"test engineers\"", + "result": "^$", + "description": "Add one scope to action category resource_action", + "command_options": "" + }, + { + "name": "check_added_scope", + "command": "action scope list $uuid_action_category", + "result": "(?P<uuid_action_scope>\\w+)\\s+testers\\s+test engineers", + "description": "Check added scope.", + "command_options": "-c id -c name -c description -f value" + }, + { + "name": "delete_scope", + "command": "action scope delete $uuid_action_category $uuid_action_scope", + "result": "^$", + "description": "Delete one scope from action category resource_action", + "command_options": "" + }, + { + "name": "check_deleted_scope", + "command": "action scope list $uuid_action_category", + "result": "(?!$uuid_action_scope)", + "description": "Check deleted scope.", + "command_options": "-c id -f value" + }, + { + "name": "delete_authz_intra_extension", + "command": "intraextension delete $uuid_authz", + "result": "", + "description": "Delete the authz intra extension", + "command_options": "" + }, + { + "name": "delete_tenant", + "command": "tenant delete $uuid", + "result": "", + "description": "Delete the tenant alt_demo", + "command_options": "" + } + ], + "authz_and_admin": [ + { + "name": "list tenant", + "command": "tenant list", + "result": "(?!alt_demo)", + "description": "Check if tenant alt_demo is used." + }, + { + "name": "add tenant alt_demo", + "command": "tenant add alt_demo", + "result": "^$", + "description": "Add a new tenant", + "command_options": "" + }, + { + "name": "check tenant alt_demo", + "command": "tenant list", + "result": "(?P<uuid>\\w+)\\s+alt_demo", + "description": "Check that tenant alt_demo has been correctly added" + }, + { + "name": "create_intraextension_authz", + "command": "intraextension create --policy_model policy_authz authz_test", + "result": "IntraExtension created: (?P<uuid_authz>\\w+)", + "description": "Create an authz intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_authz", + "command": "intraextension list", + "result": "$uuid_authz", + "description": "Check the existence of that authz intra extension" + }, + { + "name": "create_intraextension_admin", + "command": "intraextension create --policy_model policy_admin admin_test", + "result": "IntraExtension created: (?P<uuid_admin>\\w+)", + "description": "Create an admin intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_admin", + "command": "intraextension list", + "result": "$uuid_admin", + "description": "Check the existence of that admin intra extension" + }, + { + "name": "set_tenant_authz", + "command": "tenant set --authz $uuid_authz $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant demo", + "command_options": "" + }, + { + "name": "set_tenant_admin", + "command": "tenant set --admin $uuid_admin $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant alt_demo", + "command_options": "" + }, + { + "name": "check tenant alt_demo and authz ie", + "command": "tenant list", + "result": "alt_demo $uuid_authz", + "description": "Check that authz intra extension has been correctly added to the tenant.", + "command_options": "-c name -c intra_authz_extension_id -f value" + }, + { + "name": "check tenant alt_demo and admin ie", + "command": "tenant list", + "result": "$uuid_admin", + "description": "Check that admin intra extension has been correctly added to the tenant.", + "command_options": "-c intra_admin_extension_id -f value" + }, + { + "name": "select_authz_ie", + "command": "intraextension select $uuid_authz", + "result": "Select $uuid_authz IntraExtension.", + "description": "Select the authz IntraExtension", + "command_options": "" + }, + { + "name": "check_select_authz_ie", + "command": "intraextension show selected", + "result": "$uuid_authz", + "description": "Check the selected authz IntraExtension", + "command_options": "-c id -f value" + }, + { + "name": "get_one_action_category", + "command": "action category list", + "result": "(?P<uuid_action_category>\\w+)\\s+resource_action", + "description": "Get one action_category for next tests.", + "command_options": "-c id -c name -f value" + }, + { + "name": "add_scope", + "command": "action scope add $uuid_action_category testers --description \"test engineers\"", + "result": "^$", + "description": "Add one scope to action category resource_action", + "command_options": "" + }, + { + "name": "check_added_scope", + "command": "action scope list $uuid_action_category", + "result": "(?P<uuid_action_scope>\\w+)\\s+testers\\s+test engineers", + "description": "Check added scope.", + "command_options": "-c id -c name -c description -f value" + }, + { + "name": "delete_scope", + "command": "action scope delete $uuid_action_category $uuid_action_scope", + "result": "^$", + "description": "Delete one scope from action category resource_action", + "command_options": "" + }, + { + "name": "check_deleted_scope", + "command": "action scope list $uuid_action_category", + "result": "(?!$uuid_action_scope)", + "description": "Check deleted scope.", + "command_options": "-c id -f value" + }, + { + "name": "delete_admin_intra_extension", + "command": "intraextension delete $uuid_admin", + "result": "", + "description": "Delete the admin intra extension", + "command_options": "" + }, + { + "name": "delete_authz_intra_extension", + "command": "intraextension delete $uuid_authz", + "result": "", + "description": "Delete the authz intra extension", + "command_options": "" + }, + { + "name": "delete_tenant", + "command": "tenant delete $uuid", + "result": "", + "description": "Delete the tenant alt_demo", + "command_options": "" + } + ] + } +}
\ No newline at end of file diff --git a/moonclient/moonclient/tests/tests_object_scopes.json b/moonclient/moonclient/tests/tests_object_scopes.json new file mode 100644 index 00000000..f298fa12 --- /dev/null +++ b/moonclient/moonclient/tests/tests_object_scopes.json @@ -0,0 +1,254 @@ +{ + "command_options": "-f value", + "tests_group": { + "authz": [ + { + "name": "list tenant", + "command": "tenant list", + "result": "(?!alt_demo)", + "description": "Check if tenant alt_demo is used." + }, + { + "name": "add tenant alt_demo", + "command": "tenant add alt_demo", + "result": "^$", + "description": "Add a new tenant", + "command_options": "" + }, + { + "name": "check tenant alt_demo", + "command": "tenant list", + "result": "(?P<uuid>\\w+)\\s+alt_demo", + "description": "Check that tenant alt_demo has been correctly added" + }, + { + "name": "create_intraextension_authz", + "command": "intraextension create --policy_model policy_authz authz_test", + "result": "IntraExtension created: (?P<uuid_authz>\\w+)", + "description": "Create an authz intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_authz", + "command": "intraextension list", + "result": "$uuid_authz", + "description": "Check the existence of that authz intra extension" + }, + { + "name": "set_tenant_authz", + "command": "tenant set --authz $uuid_authz $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant alt_demo", + "command_options": "" + }, + { + "name": "select_authz_ie", + "command": "intraextension select $uuid_authz", + "result": "Select $uuid_authz IntraExtension.", + "description": "Select the authz IntraExtension", + "command_options": "" + }, + { + "name": "check_select_authz_ie", + "command": "intraextension show selected", + "result": "$uuid_authz", + "description": "Check the selected authz IntraExtension", + "command_options": "-c id -f value" + }, + { + "name": "get_one_object_category", + "command": "object category list", + "result": "(?P<uuid_object_category>\\w+)\\s+object_id", + "description": "Get one object_category for next tests.", + "command_options": "-c id -c name -f value" + }, + { + "name": "add_scope", + "command": "object scope add $uuid_object_category testers --description \"test engineers\"", + "result": "^$", + "description": "Add one scope to object category object_id", + "command_options": "" + }, + { + "name": "check_added_scope", + "command": "object scope list $uuid_object_category", + "result": "(?P<uuid_object_scope>\\w+)\\s+testers\\s+test engineers", + "description": "Check added scope.", + "command_options": "-c id -c name -c description -f value" + }, + { + "name": "delete_scope", + "command": "object scope delete $uuid_object_category $uuid_object_scope", + "result": "^$", + "description": "Delete one scope from object category object_id", + "command_options": "" + }, + { + "name": "check_deleted_scope", + "command": "object scope list $uuid_object_category", + "result": "(?!$uuid_object_scope)", + "description": "Check deleted scope.", + "command_options": "-c id -f value" + }, + { + "name": "delete_authz_intra_extension", + "command": "intraextension delete $uuid_authz", + "result": "", + "description": "Delete the authz intra extension", + "command_options": "" + }, + { + "name": "delete_tenant", + "command": "tenant delete $uuid", + "result": "", + "description": "Delete the tenant alt_demo", + "command_options": "" + } + ], + "authz_and_admin": [ + { + "name": "list tenant", + "command": "tenant list", + "result": "(?!alt_demo)", + "description": "Check if tenant alt_demo is used." + }, + { + "name": "add tenant alt_demo", + "command": "tenant add alt_demo", + "result": "^$", + "description": "Add a new tenant", + "command_options": "" + }, + { + "name": "check tenant alt_demo", + "command": "tenant list", + "result": "(?P<uuid>\\w+)\\s+alt_demo", + "description": "Check that tenant alt_demo has been correctly added" + }, + { + "name": "create_intraextension_authz", + "command": "intraextension create --policy_model policy_authz authz_test", + "result": "IntraExtension created: (?P<uuid_authz>\\w+)", + "description": "Create an authz intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_authz", + "command": "intraextension list", + "result": "$uuid_authz", + "description": "Check the existence of that authz intra extension" + }, + { + "name": "create_intraextension_admin", + "command": "intraextension create --policy_model policy_admin admin_test", + "result": "IntraExtension created: (?P<uuid_admin>\\w+)", + "description": "Create an admin intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_admin", + "command": "intraextension list", + "result": "$uuid_admin", + "description": "Check the existence of that admin intra extension" + }, + { + "name": "set_tenant_authz", + "command": "tenant set --authz $uuid_authz $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant demo", + "command_options": "" + }, + { + "name": "set_tenant_admin", + "command": "tenant set --admin $uuid_admin $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant alt_demo", + "command_options": "" + }, + { + "name": "check tenant alt_demo and authz ie", + "command": "tenant list", + "result": "alt_demo $uuid_authz", + "description": "Check that authz intra extension has been correctly added to the tenant.", + "command_options": "-c name -c intra_authz_extension_id -f value" + }, + { + "name": "check tenant alt_demo and admin ie", + "command": "tenant list", + "result": "$uuid_admin", + "description": "Check that admin intra extension has been correctly added to the tenant.", + "command_options": "-c intra_admin_extension_id -f value" + }, + { + "name": "select_authz_ie", + "command": "intraextension select $uuid_authz", + "result": "Select $uuid_authz IntraExtension.", + "description": "Select the authz IntraExtension", + "command_options": "" + }, + { + "name": "check_select_authz_ie", + "command": "intraextension show selected", + "result": "$uuid_authz", + "description": "Check the selected authz IntraExtension", + "command_options": "-c id -f value" + }, + { + "name": "get_one_object_category", + "command": "object category list", + "result": "(?P<uuid_object_category>\\w+)\\s+object_id", + "description": "Get one object_category for next tests.", + "command_options": "-c id -c name -f value" + }, + { + "name": "add_scope", + "command": "object scope add $uuid_object_category testers --description \"test engineers\"", + "result": "^$", + "description": "Add one scope to object category object_id", + "command_options": "" + }, + { + "name": "check_added_scope", + "command": "object scope list $uuid_object_category", + "result": "(?P<uuid_object_scope>\\w+)\\s+testers\\s+test engineers", + "description": "Check added scope.", + "command_options": "-c id -c name -c description -f value" + }, + { + "name": "delete_scope", + "command": "object scope delete $uuid_object_category $uuid_object_scope", + "result": "^$", + "description": "Delete one scope from object category object_id", + "command_options": "" + }, + { + "name": "check_deleted_scope", + "command": "object scope list $uuid_object_category", + "result": "(?!$uuid_object_scope)", + "description": "Check deleted scope.", + "command_options": "-c id -f value" + }, + { + "name": "delete_admin_intra_extension", + "command": "intraextension delete $uuid_admin", + "result": "", + "description": "Delete the admin intra extension", + "command_options": "" + }, + { + "name": "delete_authz_intra_extension", + "command": "intraextension delete $uuid_authz", + "result": "", + "description": "Delete the authz intra extension", + "command_options": "" + }, + { + "name": "delete_tenant", + "command": "tenant delete $uuid", + "result": "", + "description": "Delete the tenant alt_demo", + "command_options": "" + } + ] + } +}
\ No newline at end of file diff --git a/moonclient/moonclient/tests/tests_subject_scopes.json b/moonclient/moonclient/tests/tests_subject_scopes.json new file mode 100644 index 00000000..7b16f42b --- /dev/null +++ b/moonclient/moonclient/tests/tests_subject_scopes.json @@ -0,0 +1,254 @@ +{ + "command_options": "-f value", + "tests_group": { + "authz": [ + { + "name": "list tenant", + "command": "tenant list", + "result": "(?!alt_demo)", + "description": "Check if tenant alt_demo is used." + }, + { + "name": "add tenant alt_demo", + "command": "tenant add alt_demo", + "result": "^$", + "description": "Add a new tenant", + "command_options": "" + }, + { + "name": "check tenant alt_demo", + "command": "tenant list", + "result": "(?P<uuid>\\w+)\\s+alt_demo", + "description": "Check that tenant alt_demo has been correctly added" + }, + { + "name": "create_intraextension_authz", + "command": "intraextension create --policy_model policy_authz authz_test", + "result": "IntraExtension created: (?P<uuid_authz>\\w+)", + "description": "Create an authz intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_authz", + "command": "intraextension list", + "result": "$uuid_authz", + "description": "Check the existence of that authz intra extension" + }, + { + "name": "set_tenant_authz", + "command": "tenant set --authz $uuid_authz $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant alt_demo", + "command_options": "" + }, + { + "name": "select_authz_ie", + "command": "intraextension select $uuid_authz", + "result": "Select $uuid_authz IntraExtension.", + "description": "Select the authz IntraExtension", + "command_options": "" + }, + { + "name": "check_select_authz_ie", + "command": "intraextension show selected", + "result": "$uuid_authz", + "description": "Check the selected authz IntraExtension", + "command_options": "-c id -f value" + }, + { + "name": "get_one_subject_category", + "command": "subject category list", + "result": "(?P<uuid_subject_category>\\w+)\\s+role", + "description": "Get one subject_category for next tests.", + "command_options": "-c id -c name -f value" + }, + { + "name": "add_scope", + "command": "subject scope add $uuid_subject_category testers --description \"test engineers\"", + "result": "^$", + "description": "Add one scope to subject category role", + "command_options": "" + }, + { + "name": "check_added_scope", + "command": "subject scope list $uuid_subject_category", + "result": "(?P<uuid_subject_scope>\\w+)\\s+testers\\s+test engineers", + "description": "Check added scope.", + "command_options": "-c id -c name -c description -f value" + }, + { + "name": "delete_scope", + "command": "subject scope delete $uuid_subject_category $uuid_subject_scope", + "result": "^$", + "description": "Delete one scope from subject category role", + "command_options": "" + }, + { + "name": "check_deleted_scope", + "command": "subject scope list $uuid_subject_category", + "result": "(?!$uuid_subject_scope)", + "description": "Check deleted scope.", + "command_options": "-c id -f value" + }, + { + "name": "delete_authz_intra_extension", + "command": "intraextension delete $uuid_authz", + "result": "", + "description": "Delete the authz intra extension", + "command_options": "" + }, + { + "name": "delete_tenant", + "command": "tenant delete $uuid", + "result": "", + "description": "Delete the tenant alt_demo", + "command_options": "" + } + ], + "authz_and_admin": [ + { + "name": "list tenant", + "command": "tenant list", + "result": "(?!alt_demo)", + "description": "Check if tenant alt_demo is used." + }, + { + "name": "add tenant alt_demo", + "command": "tenant add alt_demo", + "result": "^$", + "description": "Add a new tenant", + "command_options": "" + }, + { + "name": "check tenant alt_demo", + "command": "tenant list", + "result": "(?P<uuid>\\w+)\\s+alt_demo", + "description": "Check that tenant alt_demo has been correctly added" + }, + { + "name": "create_intraextension_authz", + "command": "intraextension create --policy_model policy_authz authz_test", + "result": "IntraExtension created: (?P<uuid_authz>\\w+)", + "description": "Create an authz intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_authz", + "command": "intraextension list", + "result": "$uuid_authz", + "description": "Check the existence of that authz intra extension" + }, + { + "name": "create_intraextension_admin", + "command": "intraextension create --policy_model policy_admin admin_test", + "result": "IntraExtension created: (?P<uuid_admin>\\w+)", + "description": "Create an admin intra extension", + "command_options": "" + }, + { + "name": "list_intraextension_admin", + "command": "intraextension list", + "result": "$uuid_admin", + "description": "Check the existence of that admin intra extension" + }, + { + "name": "set_tenant_authz", + "command": "tenant set --authz $uuid_authz $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant demo", + "command_options": "" + }, + { + "name": "set_tenant_admin", + "command": "tenant set --admin $uuid_admin $uuid", + "result": "", + "description": "Connect the authz intra extension to the tenant alt_demo", + "command_options": "" + }, + { + "name": "check tenant alt_demo and authz ie", + "command": "tenant list", + "result": "alt_demo $uuid_authz", + "description": "Check that authz intra extension has been correctly added to the tenant.", + "command_options": "-c name -c intra_authz_extension_id -f value" + }, + { + "name": "check tenant alt_demo and admin ie", + "command": "tenant list", + "result": "$uuid_admin", + "description": "Check that admin intra extension has been correctly added to the tenant.", + "command_options": "-c intra_admin_extension_id -f value" + }, + { + "name": "select_authz_ie", + "command": "intraextension select $uuid_authz", + "result": "Select $uuid_authz IntraExtension.", + "description": "Select the authz IntraExtension", + "command_options": "" + }, + { + "name": "check_select_authz_ie", + "command": "intraextension show selected", + "result": "$uuid_authz", + "description": "Check the selected authz IntraExtension", + "command_options": "-c id -f value" + }, + { + "name": "get_one_subject_category", + "command": "subject category list", + "result": "(?P<uuid_subject_category>\\w+)\\s+role", + "description": "Get one subject_category for next tests.", + "command_options": "-c id -c name -f value" + }, + { + "name": "add_scope", + "command": "subject scope add $uuid_subject_category testers --description \"test engineers\"", + "result": "^$", + "description": "Add one scope to subject category role", + "command_options": "" + }, + { + "name": "check_added_scope", + "command": "subject scope list $uuid_subject_category", + "result": "(?P<uuid_subject_scope>\\w+)\\s+testers\\s+test engineers", + "description": "Check added scope.", + "command_options": "-c id -c name -c description -f value" + }, + { + "name": "delete_scope", + "command": "subject scope delete $uuid_subject_category $uuid_subject_scope", + "result": "^$", + "description": "Delete one scope from subject category role", + "command_options": "" + }, + { + "name": "check_deleted_scope", + "command": "subject scope list $uuid_subject_category", + "result": "(?!$uuid_subject_scope)", + "description": "Check deleted scope.", + "command_options": "-c id -f value" + }, + { + "name": "delete_admin_intra_extension", + "command": "intraextension delete $uuid_admin", + "result": "", + "description": "Delete the admin intra extension", + "command_options": "" + }, + { + "name": "delete_authz_intra_extension", + "command": "intraextension delete $uuid_authz", + "result": "", + "description": "Delete the authz intra extension", + "command_options": "" + }, + { + "name": "delete_tenant", + "command": "tenant delete $uuid", + "result": "", + "description": "Delete the tenant alt_demo", + "command_options": "" + } + ] + } +}
\ No newline at end of file diff --git a/moonclient/setup.py b/moonclient/setup.py index 24aea055..bdc8842a 100644 --- a/moonclient/setup.py +++ b/moonclient/setup.py @@ -101,15 +101,15 @@ setup( 'action_category_list = moonclient.action_categories:ActionCategoriesList', 'action_category_add = moonclient.action_categories:ActionCategoriesAdd', 'action_category_delete = moonclient.action_categories:ActionCategoriesDelete', - 'subject_category_scope_list = moonclient.subject_category_scope:SubjectCategoryScopeList', - 'subject_category_scope_add = moonclient.subject_category_scope:SubjectCategoryScopeAdd', - 'subject_category_scope_delete = moonclient.subject_category_scope:SubjectCategoryScopeDelete', - 'object_category_scope_list = moonclient.object_category_scope:ObjectCategoryScopeList', - 'object_category_scope_add = moonclient.object_category_scope:ObjectCategoryScopeAdd', - 'object_category_scope_delete = moonclient.object_category_scope:ObjectCategoryScopeDelete', - 'action_category_scope_list = moonclient.action_category_scope:ActionCategoryScopeList', - 'action_category_scope_add = moonclient.action_category_scope:ActionCategoryScopeAdd', - 'action_category_scope_delete = moonclient.action_category_scope:ActionCategoryScopeDelete', + 'subject_scope_list = moonclient.subject_category_scope:SubjectCategoryScopeList', + 'subject_scope_add = moonclient.subject_category_scope:SubjectCategoryScopeAdd', + 'subject_scope_delete = moonclient.subject_category_scope:SubjectCategoryScopeDelete', + 'object_scope_list = moonclient.object_category_scope:ObjectCategoryScopeList', + 'object_scope_add = moonclient.object_category_scope:ObjectCategoryScopeAdd', + 'object_scope_delete = moonclient.object_category_scope:ObjectCategoryScopeDelete', + 'action_scope_list = moonclient.action_category_scope:ActionCategoryScopeList', + 'action_scope_add = moonclient.action_category_scope:ActionCategoryScopeAdd', + 'action_scope_delete = moonclient.action_category_scope:ActionCategoryScopeDelete', 'aggregation_algorithm_list = moonclient.metarules:AggregationAlgorithmsList', 'aggregation_algorithm_show = moonclient.metarules:AggregationAlgorithmShow', 'aggregation_algorithm_set = moonclient.metarules:AggregationAlgorithmSet', |