aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2015-09-18 15:38:28 +0200
committerasteroide <thomas.duval@orange.com>2015-09-18 15:38:28 +0200
commitda160f31e8e32f91e1d1b73599122b81167a4c61 (patch)
tree966140c48042dbea9c9189394e483ccad17d2be7
parent010136510a125c7902b082c5bdbaa3eef2d3e788 (diff)
Fix the configuration commands and add the tests for them.
Change-Id: I47beb7dd0854e749fece1cd10a4591d8e9115dcc
-rw-r--r--moonclient/moonclient/configuration.py6
-rw-r--r--moonclient/moonclient/tests/tests_configuration.json230
2 files changed, 230 insertions, 6 deletions
diff --git a/moonclient/moonclient/configuration.py b/moonclient/moonclient/configuration.py
index df80d71e..09f241d7 100644
--- a/moonclient/moonclient/configuration.py
+++ b/moonclient/moonclient/configuration.py
@@ -19,8 +19,6 @@ class TemplatesList(Lister):
def take_action(self, parsed_args):
templates = self.app.get_url("/v3/OS-MOON/configuration/templates", authtoken=True)
- self.app.stdout.write(templates)
- self.app.stdout.write("\n")
return (
("id", "name", "description"),
((template_id, templates[template_id]["name"], templates[template_id]["description"])
@@ -39,8 +37,6 @@ class AggregationAlgorithmsList(Lister):
def take_action(self, parsed_args):
templates = self.app.get_url("/v3/OS-MOON/configuration/aggregation_algorithms", authtoken=True)
- self.app.stdout.write(templates)
- self.app.stdout.write("\n")
return (
("id", "name", "description"),
((template_id, templates[template_id]["name"], templates[template_id]["description"])
@@ -59,8 +55,6 @@ class SubMetaRuleAlgorithmsList(Lister):
def take_action(self, parsed_args):
templates = self.app.get_url("/v3/OS-MOON/configuration/sub_meta_rule_algorithms", authtoken=True)
- self.app.stdout.write(templates)
- self.app.stdout.write("\n")
return (
("id", "name", "description"),
((template_id, templates[template_id]["name"], templates[template_id]["description"])
diff --git a/moonclient/moonclient/tests/tests_configuration.json b/moonclient/moonclient/tests/tests_configuration.json
new file mode 100644
index 00000000..5c599b1d
--- /dev/null
+++ b/moonclient/moonclient/tests/tests_configuration.json
@@ -0,0 +1,230 @@
+{
+ "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 alt_demo",
+ "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_templates",
+ "command": "templates list",
+ "result": "policy_root",
+ "description": "Check that we have the root policy templates",
+ "command_options": "-c id -f value"
+ },
+ {
+ "name": "list_aggregation_algorithms",
+ "command": "aggregation algorithms list",
+ "result": "all_true",
+ "description": "Check that the aggregation algorithm all_true exists.",
+ "command_options": "-c name -f value"
+ },
+ {
+ "name": "list_submetarule_algorithms",
+ "command": "submetarule algorithms list",
+ "result": "comparison",
+ "description": "Check that the aggregation algorithm all_true exists.",
+ "command_options": "-c name -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_templates",
+ "command": "templates list",
+ "result": "policy_root",
+ "description": "Check that we have the root policy templates",
+ "command_options": "-c id -f value"
+ },
+ {
+ "name": "list_aggregation_algorithms",
+ "command": "aggregation algorithms list",
+ "result": "all_true",
+ "description": "Check that the aggregation algorithm all_true exists.",
+ "command_options": "-c name -f value"
+ },
+ {
+ "name": "list_submetarule_algorithms",
+ "command": "submetarule algorithms list",
+ "result": "comparison",
+ "description": "Check that the aggregation algorithm all_true exists.",
+ "command_options": "-c name -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