urlmatch: Add tests for <all_urls>

This commit is contained in:
Florian Bruhin 2018-02-15 17:11:24 +01:00
parent 867f2a8e2b
commit 28aadc4f96

View File

@ -238,16 +238,24 @@ class TestMatchChromeUrls:
class TestMatchAnything:
@pytest.fixture
def up(self):
return urlmatch.UrlPattern("*://*/*")
@pytest.fixture(params=['*://*/*', '<all_urls>'])
def up(self, request):
return urlmatch.UrlPattern(request.param)
def test_attrs(self, up):
def test_attrs_common(self, up):
assert up._scheme is None
assert up._host is None
assert up._path is None
def test_attrs_wildcard(self):
up = urlmatch.UrlPattern('*://*/*')
assert up._match_subdomains
assert not up._match_all
assert up._path == '/*'
def test_attrs_all(self):
up = urlmatch.UrlPattern('<all_urls>')
assert not up._match_subdomains
assert up._match_all
@pytest.mark.parametrize('url, expected', [
("http://127.0.0.1", True),