Exemple #1
0
def test_url_canonicalizer_want_all():
    v = URLCanonicalizer(discard_parts=())
    el = scalar(u'http://*****:*****@there/path#fragment')
    eq_(el.value, u'http://*****:*****@there/path#fragment')

    assert v.validate(el, None)
    eq_(el.value, u'http://*****:*****@there/path#fragment')
    assert not el.errors
Exemple #2
0
def test_url_canonicalizer_default():
    v = URLCanonicalizer()
    el = scalar(u'http://localhost/#foo')
    eq_(el.value, u'http://localhost/#foo')

    assert v.validate(el, None)
    eq_(el.value, u'http://localhost/')
    assert not el.errors
Exemple #3
0
def test_url_canonicalizer_default():
    v = URLCanonicalizer()
    el = scalar('http://localhost/#foo')
    eq_(el.value, 'http://localhost/#foo')

    assert v.validate(el, None)
    eq_(el.value, 'http://localhost/')
    assert not el.errors
Exemple #4
0
def test_url_canonicalizer_want_all():
    v = URLCanonicalizer(discard_parts=())
    el = scalar('http://*****:*****@there/path#fragment')
    eq_(el.value, 'http://*****:*****@there/path#fragment')

    assert v.validate(el, None)
    eq_(el.value, 'http://*****:*****@there/path#fragment')
    assert not el.errors
Exemple #5
0
def test_url_canonicalizer_want_one():
    v = URLCanonicalizer(discard_parts=_url_parts[1:])
    el = scalar("http://*****:*****@there/path#fragment")
    eq_(el.value, "http://*****:*****@there/path#fragment")

    assert v.validate(el, None)
    eq_(el.value, "http://")
    assert not el.errors