diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-03-05 19:25:17 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-03-05 19:25:17 +0100 |
commit | e4845c627e97a6d125bf33d9e7a4a8d373d7fc4a (patch) | |
tree | 634198c34aae3c0306ce30ac7452abd7b53a14e8 /test/utils | |
parent | 9b490d19dcebc0fc24cb2ab89a783f1f7d6147f7 (diff) | |
parent | 3ae93a405724ca6b5ddeb0b458fcc95685f83f09 (diff) | |
download | bsfs-e4845c627e97a6d125bf33d9e7a4a8d373d7fc4a.tar.gz bsfs-e4845c627e97a6d125bf33d9e7a4a8d373d7fc4a.tar.bz2 bsfs-e4845c627e97a6d125bf33d9e7a4a8d373d7fc4a.zip |
Merge branch 'mb/diogenes' into develop
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/test_commons.py | 5 | ||||
-rw-r--r-- | test/utils/test_uri.py | 24 | ||||
-rw-r--r-- | test/utils/test_uuid.py | 5 |
3 files changed, 14 insertions, 20 deletions
diff --git a/test/utils/test_commons.py b/test/utils/test_commons.py index 3ad6dea..29e3046 100644 --- a/test/utils/test_commons.py +++ b/test/utils/test_commons.py @@ -1,9 +1,4 @@ -""" -Part of the tagit test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # imports import unittest diff --git a/test/utils/test_uri.py b/test/utils/test_uri.py index 770e65a..1c4c9f9 100644 --- a/test/utils/test_uri.py +++ b/test/utils/test_uri.py @@ -1,9 +1,4 @@ -""" -Part of the tagit test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # imports import operator import unittest @@ -40,6 +35,16 @@ class TestURI(unittest.TestCase): self.assertTrue(URI.is_parseable('telnet://192.0.2.16:80/')) self.assertTrue(URI.is_parseable('urn:oasis:names:specification:docbook:dtd:xml:4.1.2')) + # some characters are prohibited + self.assertFalse(URI.is_parseable('http://example.com/foo<bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo>bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo{bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo}bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo|bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo^bar')) + self.assertFalse(URI.is_parseable('http://example.com/foo\\bar')) + # uri cannot end with a scheme delimiter self.assertFalse(URI.is_parseable('http://')) # port must be a number @@ -164,10 +169,10 @@ class TestURI(unittest.TestCase): def test_overloaded(self): # composition - self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment') + 'hello', URI) - self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment') * 2, URI) - self.assertIsInstance(2 * URI('http://user@www.example.com:1234/{}/path1?{}#fragment'), URI) # rmul - self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment').join(['hello', 'world']) , URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment') + 'hello', URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment') * 2, URI) + self.assertIsInstance(2 * URI('http://user@www.example.com:1234/path0/path1?query#fragment'), URI) # rmul + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').join(['hello', 'world']) , URI) # stripping self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').strip(), URI) self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').lstrip(), URI) @@ -176,7 +181,6 @@ class TestURI(unittest.TestCase): self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').lower(), URI) self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').upper(), URI) # formatting - self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment').format('hello', 'world'), URI) self.assertIsInstance(URI('http://user@www.example.com:1234/%s/path1?%s#fragment') % ('hello', 'world'), URI) self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').replace('path0', 'pathX'), URI) diff --git a/test/utils/test_uuid.py b/test/utils/test_uuid.py index 804b063..8f519d9 100644 --- a/test/utils/test_uuid.py +++ b/test/utils/test_uuid.py @@ -1,9 +1,4 @@ -""" -Part of the tagit test suite. -A copy of the license is provided with the project. -Author: Matthias Baumgartner, 2022 -""" # imports import os import re |