summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler/test_schema.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2020-04-24 14:39:25 -0600
committerGitHub <noreply@github.com>2020-04-24 14:39:25 -0600
commit61a19249c2010743a467a51f8f0750712c2d92e0 (patch)
tree480e5807d6ab5c0033fd51ad65b3996648e79653 /tests/unittests/test_handler/test_schema.py
parent72f6eb0339f7fcf7b8b02be2e86e5f7477cf731c (diff)
downloadvyos-cloud-init-61a19249c2010743a467a51f8f0750712c2d92e0.tar.gz
vyos-cloud-init-61a19249c2010743a467a51f8f0750712c2d92e0.zip
schema: add json schema for write_files module (#152)
Add schema definition to cc_write_files.py Cloud-config containing write_files config directives will now emit warnings for invalid config keys or values for the write_files module. Add an extension to JSON schema's draft4validator to permit either binary or text values for 'string' objects. This allows for JSON schema validating the YAML declaration of binary valiues in cloud-config using YAML's '!!binary' syntax. Add the ability to pass a specific module name to `cloud-init devel schema --docs <module_name>|all` to optionally limit doc output during development to a single schema doc.
Diffstat (limited to 'tests/unittests/test_handler/test_schema.py')
-rw-r--r--tests/unittests/test_handler/test_schema.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py
index 98628120..2d4536d9 100644
--- a/tests/unittests/test_handler/test_schema.py
+++ b/tests/unittests/test_handler/test_schema.py
@@ -29,6 +29,7 @@ class GetSchemaTest(CiTestCase):
'cc_snap',
'cc_ubuntu_advantage',
'cc_ubuntu_drivers',
+ 'cc_write_files',
'cc_zypper_add_repo'
],
[subschema['id'] for subschema in schema['allOf']])
@@ -351,7 +352,7 @@ class MainTest(CiTestCase):
main()
self.assertEqual(1, context_manager.exception.code)
self.assertEqual(
- 'Expected either --config-file argument or --doc\n',
+ 'Expected either --config-file argument or --docs\n',
m_stderr.getvalue())
def test_main_absent_config_file(self):
@@ -367,8 +368,8 @@ class MainTest(CiTestCase):
m_stderr.getvalue())
def test_main_prints_docs(self):
- """When --doc parameter is provided, main generates documentation."""
- myargs = ['mycmd', '--doc']
+ """When --docs parameter is provided, main generates documentation."""
+ myargs = ['mycmd', '--docs', 'all']
with mock.patch('sys.argv', myargs):
with mock.patch('sys.stdout', new_callable=StringIO) as m_stdout:
self.assertEqual(0, main(), 'Expected 0 exit code')