diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-03-23 15:16:55 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2018-03-23 15:16:55 -0400 |
commit | 0c2f1ea29abc88957d21f56d432649989a8e4dfd (patch) | |
tree | e51ce5a9016ce764b878162ae27e31b3f423350c /cloudinit/config/tests | |
parent | 10065b1e5f0867978bb10472f609aa9238311367 (diff) | |
download | vyos-cloud-init-0c2f1ea29abc88957d21f56d432649989a8e4dfd.tar.gz vyos-cloud-init-0c2f1ea29abc88957d21f56d432649989a8e4dfd.zip |
tests: Fix newly added schema unit tests to skip if no jsonschema.
The recently added snap and ubuntu_advantage modules had unit tests
that exercised jsonschema. Those throw error if jsonschema is
not present. Fix to skip in that scenario.
Diffstat (limited to 'cloudinit/config/tests')
-rw-r--r-- | cloudinit/config/tests/test_snap.py | 5 | ||||
-rw-r--r-- | cloudinit/config/tests/test_ubuntu_advantage.py | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/cloudinit/config/tests/test_snap.py b/cloudinit/config/tests/test_snap.py index 988e7f7c..c5b4a9de 100644 --- a/cloudinit/config/tests/test_snap.py +++ b/cloudinit/config/tests/test_snap.py @@ -8,7 +8,8 @@ from cloudinit.config.cc_snap import ( run_commands, schema) from cloudinit.config.schema import validate_cloudconfig_schema from cloudinit import util -from cloudinit.tests.helpers import CiTestCase, mock, wrap_and_call +from cloudinit.tests.helpers import ( + CiTestCase, mock, wrap_and_call, skipUnlessJsonSchema) SYSTEM_USER_ASSERTION = """\ @@ -243,6 +244,7 @@ class TestRunCommands(CiTestCase): self.assertEqual('MOM\nHI\n', util.load_file(outfile)) +@skipUnlessJsonSchema() class TestSchema(CiTestCase): with_logs = True @@ -418,6 +420,7 @@ class TestHandle(CiTestCase): util.load_file(compare_file), util.load_file(assert_file)) @mock.patch('cloudinit.config.cc_snap.util.subp') + @skipUnlessJsonSchema() def test_handle_validates_schema(self, m_subp): """Any provided configuration is runs validate_cloudconfig_schema.""" assert_file = self.tmp_path('snapd.assertions', dir=self.tmp) diff --git a/cloudinit/config/tests/test_ubuntu_advantage.py b/cloudinit/config/tests/test_ubuntu_advantage.py index 0eeadd43..f2a59faf 100644 --- a/cloudinit/config/tests/test_ubuntu_advantage.py +++ b/cloudinit/config/tests/test_ubuntu_advantage.py @@ -7,7 +7,7 @@ from cloudinit.config.cc_ubuntu_advantage import ( handle, maybe_install_ua_tools, run_commands, schema) from cloudinit.config.schema import validate_cloudconfig_schema from cloudinit import util -from cloudinit.tests.helpers import CiTestCase, mock +from cloudinit.tests.helpers import CiTestCase, mock, skipUnlessJsonSchema # Module path used in mocks @@ -104,6 +104,7 @@ class TestRunCommands(CiTestCase): self.assertEqual('MOM\nHI\n', util.load_file(outfile)) +@skipUnlessJsonSchema() class TestSchema(CiTestCase): with_logs = True |