about summary refs log tree commit diff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-02-19 22:50:23 +0700
committerSergey M․ <dstftw@gmail.com>2018-02-19 22:50:23 +0700
commitbefa4708fd2165b85d04002c3845adf191d34302 (patch)
treebe0eaae66b9f4aa11100d12c6c0c6a1e0d18851b /test/test_utils.py
parent90830004c893e2d5f0643c05af064cfc7a3b579e (diff)
downloadyoutube-dl-befa4708fd2165b85d04002c3845adf191d34302.tar.gz
youtube-dl-befa4708fd2165b85d04002c3845adf191d34302.tar.xz
youtube-dl-befa4708fd2165b85d04002c3845adf191d34302.zip
[utils] Fixup some common URL's typos in sanitize_url (closes #15649)
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index fdf6031f7..d8d257d1d 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -57,6 +57,7 @@ from youtube_dl.utils import (
     read_batch_urls,
     sanitize_filename,
     sanitize_path,
+    sanitize_url,
     expand_path,
     prepend_extension,
     replace_extension,
@@ -219,6 +220,12 @@ class TestUtil(unittest.TestCase):
         self.assertEqual(sanitize_path('./abc'), 'abc')
         self.assertEqual(sanitize_path('./../abc'), '..\\abc')
 
+    def test_sanitize_url(self):
+        self.assertEqual(sanitize_url('//foo.bar'), 'http://foo.bar')
+        self.assertEqual(sanitize_url('httpss://foo.bar'), 'https://foo.bar')
+        self.assertEqual(sanitize_url('rmtps://foo.bar'), 'rtmps://foo.bar')
+        self.assertEqual(sanitize_url('https://foo.bar'), 'https://foo.bar')
+
     def test_expand_path(self):
         def env(var):
             return '%{0}%'.format(var) if sys.platform == 'win32' else '${0}'.format(var)