Permalink
Browse files

[schema] Validate dns_search hostname format #42

  • Loading branch information...
nemesisdesign committed Apr 4, 2016
1 parent abb63bd commit f1116f0b2aa2eebbd4d58e27c2b96a91555bd71f
Showing with 12 additions and 1 deletion.
  1. +2 −1 netjsonconfig/schema.py
  2. +10 −0 tests/openwrt/test_formats.py
@@ -699,7 +699,8 @@
"propertyOrder": 5,
"items": {
"title": "Domain",
"type": "string"
"type": "string",
"format": "hostname"
}
},
"routes": {
@@ -73,3 +73,13 @@ def test_ntp_servers_hostname(self):
o.config['ntp']['server'][0] = 'totally/wrong'
with self.assertRaises(ValidationError):
o.validate()
def test_dns_search_hostname(self):
o = OpenWrt({
"dns_search": ['openwisp.org', 'test.netjson.org']
})
o.validate()
# invalid hostname
o.config['dns_search'].append('very/wrong')
with self.assertRaises(ValidationError):
o.validate()

0 comments on commit f1116f0

Please sign in to comment.