summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2016-11-02 02:14:01 +0700
committerSergey M․ <[email protected]>2016-11-02 02:30:18 +0700
commit02dc0a36b72b7312996d59b9ec96768f925cb4a4 (patch)
tree9131cde2d8f6ed7463b1254a33fada2ed8530d73 /test
parent639e3b5c9985aacf7c0dc018c211a78161bbafd2 (diff)
downloadyoutube-dl-02dc0a36b72b7312996d59b9ec96768f925cb4a4.tar.gz
youtube-dl-02dc0a36b72b7312996d59b9ec96768f925cb4a4.zip
[utils] Introduce base_url
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index b1b2effca..cb75ca53e 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -69,6 +69,7 @@ from youtube_dl.utils import (
uppercase_escape,
lowercase_escape,
url_basename,
+ base_url,
urlencode_postdata,
urshift,
update_url_query,
@@ -437,6 +438,13 @@ class TestUtil(unittest.TestCase):
url_basename('http://media.w3.org/2010/05/sintel/trailer.mp4'),
'trailer.mp4')
+ def test_base_url(self):
+ self.assertEqual(base_url('http://foo.de/'), 'http://foo.de/')
+ self.assertEqual(base_url('http://foo.de/bar'), 'http://foo.de/')
+ self.assertEqual(base_url('http://foo.de/bar/'), 'http://foo.de/bar/')
+ self.assertEqual(base_url('http://foo.de/bar/baz'), 'http://foo.de/bar/')
+ self.assertEqual(base_url('http://foo.de/bar/baz?x=z/x/c'), 'http://foo.de/bar/')
+
def test_parse_age_limit(self):
self.assertEqual(parse_age_limit(None), None)
self.assertEqual(parse_age_limit(False), None)