Skip to content
Snippets Groups Projects
Commit b7e77c25 authored by Matt Traudt's avatar Matt Traudt
Browse files

Test validate_url

parent 4e557aea
No related branches found
No related tags found
No related merge requests found
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment