| Index: recipe_modules/url/tests/validate_url.py
|
| diff --git a/recipe_modules/url/tests/validate_url.py b/recipe_modules/url/tests/validate_url.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c2ba6162db7c5d6fd6d905cb140993aebad3ac7c
|
| --- /dev/null
|
| +++ b/recipe_modules/url/tests/validate_url.py
|
| @@ -0,0 +1,30 @@
|
| +# Copyright 2017 The LUCI Authors. All rights reserved.
|
| +# Use of this source code is governed under the Apache License, Version 2.0
|
| +# that can be found in the LICENSE file.
|
| +
|
| +DEPS = [
|
| + 'properties',
|
| + 'step',
|
| + 'url',
|
| +]
|
| +
|
| +
|
| +def RunSteps(api):
|
| + api.url.validate_url(api.properties['url_to_validate'])
|
| +
|
| +
|
| +def GenTests(api):
|
| + yield (api.test('basic') +
|
| + api.properties(url_to_validate='https://example.com'))
|
| +
|
| + yield (api.test('no_scheme') +
|
| + api.properties(url_to_validate='example.com') +
|
| + api.expect_exception('ValueError'))
|
| +
|
| + yield (api.test('invalid_scheme') +
|
| + api.properties(url_to_validate='ftp://example.com') +
|
| + api.expect_exception('ValueError'))
|
| +
|
| + yield (api.test('no_host') +
|
| + api.properties(url_to_validate='https://') +
|
| + api.expect_exception('ValueError'))
|
|
|