From 395177145622a5c37b8cfb53989084e2ff03ad98 Mon Sep 17 00:00:00 2001 From: Anusha Unnam Date: Fri, 17 Mar 2017 15:48:47 +0000 Subject: [PATCH] Comment out the rule from generated sample-policy file blueprint policy-docs Change-Id: I8077f15c6b231b13c3f96ed5325795958c2cb75f --- oslo_policy/generator.py | 2 +- oslo_policy/tests/test_generator.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/oslo_policy/generator.py b/oslo_policy/generator.py index aaf8019b..14284add 100644 --- a/oslo_policy/generator.py +++ b/oslo_policy/generator.py @@ -110,7 +110,7 @@ def _format_rule_default_yaml(default, include_help=True): {'name': default.name, 'check_str': default.check_str}) if include_help: - text = ('%(help)s\n%(text)s\n' % + text = ('%(help)s\n#%(text)s\n' % {'help': _format_help_text(default.description), 'text': text}) return text diff --git a/oslo_policy/tests/test_generator.py b/oslo_policy/tests/test_generator.py index e94fc6cd..dca75f9b 100644 --- a/oslo_policy/tests/test_generator.py +++ b/oslo_policy/tests/test_generator.py @@ -89,17 +89,17 @@ class GenerateSampleTestCase(base.PolicyBaseTestCase): extensions=extensions, namespace=['base_rules', 'rules']) expected = '''# Basic admin check -"admin": "is_admin:True" +#"admin": "is_admin:True" # This is a long description to check that line wrapping functions # properly -"owner": "project_id:%(project_id)s" +#"owner": "project_id:%(project_id)s" # -"shared": "field:networks:shared=True" +#"shared": "field:networks:shared=True" # -"admin_or_owner": "rule:admin or rule:owner" +#"admin_or_owner": "rule:admin or rule:owner" ''' output_file = self.get_config_file_fullname('policy.yaml') @@ -126,17 +126,17 @@ class GenerateSampleTestCase(base.PolicyBaseTestCase): extensions=extensions, namespace=['base_rules', 'rules']) expected = '''# Basic admin check -"admin": "is_admin:True" +#"admin": "is_admin:True" # This is a long description to check that line wrapping functions # properly -"owner": "project_id:%(project_id)s" +#"owner": "project_id:%(project_id)s" # -"shared": "field:networks:shared=True" +#"shared": "field:networks:shared=True" # -"admin_or_owner": "rule:admin or rule:owner" +#"admin_or_owner": "rule:admin or rule:owner" ''' stdout = self._capture_stdout() @@ -168,7 +168,7 @@ class GenerateSampleTestCase(base.PolicyBaseTestCase): expected = '''# Check Summary # # This is a description to check that empty line has no white spaces. -"admin": "is_admin:True" +#"admin": "is_admin:True" ''' output_file = self.get_config_file_fullname('policy.yaml')