aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 4f5fa1e10..d4b846f56 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -221,9 +221,10 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_filename('N0Y__7-UOdI', is_id=True), 'N0Y__7-UOdI')
def test_sanitize_path(self):
- if sys.platform != 'win32':
- return
+ with unittest.mock.patch('sys.platform', 'win32'):
+ self._test_sanitize_path()
+ def _test_sanitize_path(self):
self.assertEqual(sanitize_path('abc'), 'abc')
self.assertEqual(sanitize_path('abc/def'), 'abc\\def')
self.assertEqual(sanitize_path('abc\\def'), 'abc\\def')
@@ -256,6 +257,11 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_path('./abc'), 'abc')
self.assertEqual(sanitize_path('./../abc'), '..\\abc')
+ self.assertEqual(sanitize_path('\\abc'), '\\abc')
+ self.assertEqual(sanitize_path('C:abc'), 'C:abc')
+ self.assertEqual(sanitize_path('C:abc\\..\\'), 'C:..')
+ self.assertEqual(sanitize_path('C:\\abc:%(title)s.%(ext)s'), 'C:\\abc#%(title)s.%(ext)s')
+
def test_sanitize_url(self):
self.assertEqual(sanitize_url('//foo.bar'), 'http://foo.bar')
self.assertEqual(sanitize_url('httpss://foo.bar'), 'https://foo.bar')