Exemple #1
0
def validate_url(node, cstruct):
    try:
        util.validate_url(cstruct)
    except ValueError as exc:
        raise colander.Invalid(node, str(exc))
Exemple #2
0
def validate_url(node, cstruct):
    try:
        util.validate_url(cstruct)
    except ValueError as exc:
        raise colander.Invalid(node, str(exc))
Exemple #3
0
def test_validate_url_rejects_non_http_urls():
    with pytest.raises(ValueError):
        validate_url("mailto:[email protected]")
Exemple #4
0
def test_validate_url_rejects_urls_without_domains():
    with pytest.raises(ValueError):
        validate_url("http:///path")
Exemple #5
0
def test_validate_url_adds_http_prefix():
    assert validate_url("github.com/jimsmith") == "http://github.com/jimsmith"
Exemple #6
0
def test_validate_url_accepts_http_urls():
    validate_url("http://github.com/jimsmith")
Exemple #7
0
def test_validate_url_rejects_urls_without_domains():
    with pytest.raises(ValueError):
        validate_url("http:///path")
Exemple #8
0
def test_validate_url_rejects_non_http_urls():
    with pytest.raises(ValueError):
        validate_url("mailto:[email protected]")
Exemple #9
0
def test_validate_url_accepts_http_urls():
    validate_url("http://github.com/jimsmith")
Exemple #10
0
def test_validate_url_adds_http_prefix():
    assert validate_url("github.com/jimsmith") == "http://github.com/jimsmith"
Exemple #11
0
def test_validate_url_adds_http_prefix():
    assert validate_url('github.com/jimsmith') == 'http://github.com/jimsmith'