summaryrefslogtreecommitdiff
path: root/tests/unittests/test_cli.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-09-20 23:41:22 -0600
committerChad Smith <chad.smith@canonical.com>2017-09-20 23:41:22 -0600
commit27613443139578dd1b968d1f5f953bd2bc6245a4 (patch)
treeb9f68975b4a264d2cae499f0a4ef7d345113ca78 /tests/unittests/test_cli.py
parentd3a8777244ebc107e1124c4fab441b5e0eb75f44 (diff)
downloadvyos-cloud-init-27613443139578dd1b968d1f5f953bd2bc6245a4.tar.gz
vyos-cloud-init-27613443139578dd1b968d1f5f953bd2bc6245a4.zip
docs: fix sphinx module schema documentation
Create a copy of each modules schema attribute when generating sphinx docs to avoid altering the actual module dict in memory. This avoids illegible rendering of module examples and distros where each character of a list was represented on a separate line by itself. Fixes ntp, resizefs, runcmd and bootcmd docs.
Diffstat (limited to 'tests/unittests/test_cli.py')
-rw-r--r--tests/unittests/test_cli.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
index 258a9f08..fccbbd23 100644
--- a/tests/unittests/test_cli.py
+++ b/tests/unittests/test_cli.py
@@ -125,6 +125,21 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
'Expected either --config-file argument or --doc\n',
self.stderr.getvalue())
+ def test_wb_devel_schema_subcommand_doc_content(self):
+ """Validate that doc content is sane from known examples."""
+ stdout = six.StringIO()
+ self.patchStdoutAndStderr(stdout=stdout)
+ self._call_main(['cloud-init', 'devel', 'schema', '--doc'])
+ expected_doc_sections = [
+ '**Supported distros:** all',
+ '**Supported distros:** centos, debian, fedora',
+ '**Config schema**:\n **resize_rootfs:** (true/false/noblock)',
+ '**Examples**::\n\n runcmd:\n - [ ls, -l, / ]\n'
+ ]
+ stdout = stdout.getvalue()
+ for expected in expected_doc_sections:
+ self.assertIn(expected, stdout)
+
@mock.patch('cloudinit.cmd.main.main_single')
def test_single_subcommand(self, m_main_single):
"""The subcommand 'single' calls main_single with valid args."""