aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/haketilo_test/unit/test_patterns.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/haketilo_test/unit/test_patterns.py b/test/haketilo_test/unit/test_patterns.py
index f2eeaf8..2ba4dce 100644
--- a/test/haketilo_test/unit/test_patterns.py
+++ b/test/haketilo_test/unit/test_patterns.py
@@ -103,6 +103,9 @@ def test_deconstruct_url(execute_in_page):
assert deco['domain'] == ['example', 'com']
assert deco['path'] == ['a', 'b']
+ reco = execute_in_page('returnval(reconstruct_url(arguments[0]));', deco)
+ assert reco == 'https://example.com/a/b'
+
deco = execute_in_page('returnval(deconstruct_url(arguments[0]));',
'http://**.example.com/')
assert deco
@@ -111,6 +114,9 @@ def test_deconstruct_url(execute_in_page):
assert deco['domain'] == ['**', 'example', 'com']
assert deco['path'] == []
+ reco = execute_in_page('returnval(reconstruct_url(arguments[0]));', deco)
+ assert reco == 'http://**.example.com/'
+
deco = execute_in_page('returnval(deconstruct_url(arguments[0]));',
'ftp://user@ftp.example.com/all///passwords.txt/')
assert deco
@@ -119,6 +125,9 @@ def test_deconstruct_url(execute_in_page):
assert deco['domain'] == ['ftp', 'example', 'com']
assert deco['path'] == ['all', 'passwords.txt']
+ reco = execute_in_page('returnval(reconstruct_url(arguments[0]));', deco)
+ assert reco == 'ftp://ftp.example.com/all/passwords.txt/'
+
deco = execute_in_page('returnval(deconstruct_url(arguments[0]));',
'ftp://mirror.edu.pl.eu.org')
assert deco
@@ -127,6 +136,9 @@ def test_deconstruct_url(execute_in_page):
assert deco['domain'] == ['mirror', 'edu', 'pl', 'eu', 'org']
assert deco['path'] == []
+ reco = execute_in_page('returnval(reconstruct_url(arguments[0]));', deco)
+ assert reco == 'ftp://mirror.edu.pl.eu.org'
+
deco = execute_in_page('returnval(deconstruct_url(arguments[0]));',
'file:///mnt/parabola_chroot///etc/passwd')
assert deco
@@ -135,6 +147,9 @@ def test_deconstruct_url(execute_in_page):
assert deco['path'] == ['mnt', 'parabola_chroot', 'etc', 'passwd']
assert 'domain' not in deco
+ reco = execute_in_page('returnval(reconstruct_url(arguments[0]));', deco)
+ assert reco == 'file:///mnt/parabola_chroot/etc/passwd'
+
for bad_url in [
'://bad-url.missing/protocol',
'http:/example.com/a/b',