Commit b7e77c25 authored by Matt Traudt's avatar Matt Traudt
Browse files

Test validate_url

parent 4e557aea
......@@ -186,3 +186,23 @@ def test_validate_bool():
valid, reason = con._validate_boolean(conf['sec'], 'key')
assert not valid, '{} should not have been a valid '\
'bool'.format(val)
def test_validate_url():
goods = [
'http://example.com',
'http://example.com/foo.bar',
]
bads = [
'ftp://example.com/foo.bar',
'http://', 'http:///',
]
for val in goods:
d = {'': val}
valid, reason = con._validate_url(d, '')
assert valid, '{} should have been a valid URL, but '\
'got: {}'.format(val, reason)
for val in bads:
d = {'': val}
valid, reason = con._validate_url(d, '')
assert not valid, '{} should not have been a valid URL'.format(val)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment