summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2021-10-22 22:06:51 -0500
committerGitHub <noreply@github.com>2021-10-22 21:06:51 -0600
commit2db713346d656c3486228678ad020b56440c1e34 (patch)
tree5191e071a845328405caa5ee6a65878612898cd2 /tests/unittests/test_handler
parent6cf9dc870f69f8d910388193a4a59474117915b7 (diff)
downloadvyos-cloud-init-2db713346d656c3486228678ad020b56440c1e34.tar.gz
vyos-cloud-init-2db713346d656c3486228678ad020b56440c1e34.zip
Remove pin in dependencies for jsonschema (#1078)
In jsonschema 4, hostname validation was changed to have an optional dependency on the fqdn package. Since we don't have this dependency in cloud-init, attempting this validation will no longer fail for a string that isn't a valid hostname.
Diffstat (limited to 'tests/unittests/test_handler')
-rw-r--r--tests/unittests/test_handler/test_schema.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py
index 6b0b1f74..6f37ceb7 100644
--- a/tests/unittests/test_handler/test_schema.py
+++ b/tests/unittests/test_handler/test_schema.py
@@ -108,11 +108,11 @@ class ValidateCloudConfigSchemaTest(CiTestCase):
def test_validateconfig_schema_honors_formats(self):
"""With strict True, validate_cloudconfig_schema errors on format."""
schema = {
- 'properties': {'p1': {'type': 'string', 'format': 'hostname'}}}
+ 'properties': {'p1': {'type': 'string', 'format': 'email'}}}
with self.assertRaises(SchemaValidationError) as context_mgr:
validate_cloudconfig_schema({'p1': '-1'}, schema, strict=True)
self.assertEqual(
- "Cloud config schema errors: p1: '-1' is not a 'hostname'",
+ "Cloud config schema errors: p1: '-1' is not a 'email'",
str(context_mgr.exception))
@@ -189,12 +189,12 @@ class ValidateCloudConfigFileTest(CiTestCase):
def test_validateconfig_file_sctrictly_validates_schema(self):
"""validate_cloudconfig_file raises errors on invalid schema."""
schema = {
- 'properties': {'p1': {'type': 'string', 'format': 'hostname'}}}
- write_file(self.config_file, '#cloud-config\np1: "-1"')
+ 'properties': {'p1': {'type': 'string', 'format': 'string'}}}
+ write_file(self.config_file, '#cloud-config\np1: -1')
with self.assertRaises(SchemaValidationError) as context_mgr:
validate_cloudconfig_file(self.config_file, schema)
self.assertEqual(
- "Cloud config schema errors: p1: '-1' is not a 'hostname'",
+ "Cloud config schema errors: p1: -1 is not of type 'string'",
str(context_mgr.exception))