From 28aadc4f96034465a0d33830bdff77c2f29705b5 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 15 Feb 2018 17:11:24 +0100 Subject: [PATCH] urlmatch: Add tests for --- tests/unit/utils/test_urlmatch.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/unit/utils/test_urlmatch.py b/tests/unit/utils/test_urlmatch.py index 23ca58acc..2a33675ae 100644 --- a/tests/unit/utils/test_urlmatch.py +++ b/tests/unit/utils/test_urlmatch.py @@ -238,16 +238,24 @@ class TestMatchChromeUrls: class TestMatchAnything: - @pytest.fixture - def up(self): - return urlmatch.UrlPattern("*://*/*") + @pytest.fixture(params=['*://*/*', '']) + 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('') + assert not up._match_subdomains + assert up._match_all @pytest.mark.parametrize('url, expected', [ ("http://127.0.0.1", True),