summaryrefslogtreecommitdiff
path: root/tests/test_url_patterns.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-10 10:05:10 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-10 10:05:10 +0200
commitea3300de1269c1c2e1fe76f6a6dec534936cc303 (patch)
treed3f7690266ca04c3a3d99444880d2c64972dc23f /tests/test_url_patterns.py
parentb2055032cb914fd160270971dd1da46f8c7c838d (diff)
downloadhaketilo-hydrilla-ea3300de1269c1c2e1fe76f6a6dec534936cc303.tar.gz
haketilo-hydrilla-ea3300de1269c1c2e1fe76f6a6dec534936cc303.zip
[builder][server] fix old tests
Diffstat (limited to 'tests/test_url_patterns.py')
-rw-r--r--tests/test_url_patterns.py62
1 files changed, 29 insertions, 33 deletions
diff --git a/tests/test_url_patterns.py b/tests/test_url_patterns.py
index c308f18..f01c493 100644
--- a/tests/test_url_patterns.py
+++ b/tests/test_url_patterns.py
@@ -15,38 +15,34 @@ from hydrilla.exceptions import HaketiloException
from .url_patterns_common import *
-# @pytest.mark.parametrize('_in, out', [
-# ({}, sample_url_str),
-# ({'path_segments': ()}, 'http://example.com'),
-# ({'has_trailing_slash': True}, 'http://example.com/aa/bb/'),
-# ({'orig_scheme': 'http*'}, 'http*://example.com/aa/bb'),
-# ({'scheme': 'http_sth'}, 'http://example.com/aa/bb'),
-# ({'port': 443}, 'http://example.com:443/aa/bb'),
-
-# ({'path_segments': (),
-# 'has_trailing_slash': True},
-# 'http://example.com/'),
-
-# ({'orig_scheme': 'https',
-# 'scheme': 'https',
-# 'port': 443},
-# 'https://example.com/aa/bb'),
-
-# ({'orig_scheme': 'ftp',
-# 'scheme': 'ftp',
-# 'port': 21},
-# 'ftp://example.com/aa/bb'),
-
-# ({'orig_scheme': 'file',
-# 'scheme': 'file',
-# 'port': None,
-# 'domain_labels': ()},
-# 'file:///aa/bb')
-# ])
-# def test_reconstruct_parsed_url(_in, out, sample_url_parsed):
-# """Test the reconstruct_url() method of ParsedUrl class."""
-# parsed_url = dc.replace(sample_url_parsed, **_in)
-# assert parsed_url.reconstruct_url() == out
+@pytest.mark.parametrize('_in, out', [
+ ({}, sample_url_str),
+ ({'path_segments': ()}, 'http://example.com'),
+ ({'has_trailing_slash': True}, 'http://example.com/aa/bb/'),
+ ({'scheme': 'http_sth'}, 'http_sth://example.com:80/aa/bb'),
+ ({'port': 443}, 'http://example.com:443/aa/bb'),
+
+ ({'path_segments': (),
+ 'has_trailing_slash': True},
+ 'http://example.com/'),
+
+ ({'scheme': 'https',
+ 'port': 443},
+ 'https://example.com/aa/bb'),
+
+ ({'scheme': 'ftp',
+ 'port': 21},
+ 'ftp://example.com/aa/bb'),
+
+ ({'scheme': 'file',
+ 'port': None,
+ 'domain_labels': ()},
+ 'file:///aa/bb')
+])
+def test_reconstruct_parsed_url(_in, out, sample_url_parsed):
+ """Test the reconstruct_url() method of ParsedUrl class."""
+ parsed_url = dc.replace(sample_url_parsed, **_in)
+ assert parsed_url.reconstruct_url() == out
@pytest.mark.parametrize('_in, out', [
({'url': sample_url_str}, {}),
@@ -169,7 +165,7 @@ def test_parse_pattern(monkeypatch, _in, out):
monkeypatch.setattr(url_patterns, '_parse_pattern_or_url',
mocked_parse_pattern_or_url)
- assert url_patterns.parse_pattern(_in) == out
+ assert tuple(url_patterns.parse_pattern(_in)) == out
def test_parse_url(monkeypatch):
"""...."""