aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_http.py
diff options
context:
space:
mode:
authorfelix <felix.von.s@posteo.de>2021-12-30 13:23:36 +0100
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-04-12 05:32:50 +0530
commitcfb0511d822b39748c5a64dfe86b61ff8d5af176 (patch)
tree3988b2fd19f0b1bdf5e946381a1e96d86b39a2c0 /test/test_http.py
parentab96d1ad1bcdb943aa6519980e5383ca91f7da2b (diff)
downloadhypervideo-pre-cfb0511d822b39748c5a64dfe86b61ff8d5af176.tar.lz
hypervideo-pre-cfb0511d822b39748c5a64dfe86b61ff8d5af176.tar.xz
hypervideo-pre-cfb0511d822b39748c5a64dfe86b61ff8d5af176.zip
[cleanup] Remove unused code paths (#2173)
Notes: * `_windows_write_string`: Fixed in 3.6 * https://bugs.python.org/issue1602 * PEP: https://www.python.org/dev/peps/pep-0528 * Windows UTF-8 fix: Fixed in 3.3 * https://bugs.python.org/issue13216 * `__loader__`: is always present in 3.3+ * https://bugs.python.org/issue14646 * `workaround_optparse_bug9161`: Fixed in 2.7 * https://bugs.python.org/issue9161 Authored by: fstirlitz
Diffstat (limited to 'test/test_http.py')
-rw-r--r--test/test_http.py29
1 files changed, 4 insertions, 25 deletions
diff --git a/test/test_http.py b/test/test_http.py
index 40df167e0..eec8684b1 100644
--- a/test/test_http.py
+++ b/test/test_http.py
@@ -32,17 +32,6 @@ class HTTPTestRequestHandler(compat_http_server.BaseHTTPRequestHandler):
self.send_header('Content-Type', 'video/mp4')
self.end_headers()
self.wfile.write(b'\x00\x00\x00\x00\x20\x66\x74[video]')
- elif self.path == '/302':
- if sys.version_info[0] == 3:
- # XXX: Python 3 http server does not allow non-ASCII header values
- self.send_response(404)
- self.end_headers()
- return
-
- new_url = 'http://127.0.0.1:%d/中文.html' % http_server_port(self.server)
- self.send_response(302)
- self.send_header(b'Location', new_url.encode('utf-8'))
- self.end_headers()
elif self.path == '/%E4%B8%AD%E6%96%87.html':
self.send_response(200)
self.send_header('Content-Type', 'text/html; charset=utf-8')
@@ -72,15 +61,6 @@ class TestHTTP(unittest.TestCase):
self.server_thread.daemon = True
self.server_thread.start()
- def test_unicode_path_redirection(self):
- # XXX: Python 3 http server does not allow non-ASCII header values
- if sys.version_info[0] == 3:
- return
-
- ydl = YoutubeDL({'logger': FakeLogger()})
- r = ydl.extract_info('http://127.0.0.1:%d/302' % self.port)
- self.assertEqual(r['entries'][0]['url'], 'http://127.0.0.1:%d/vid.mp4' % self.port)
-
class TestHTTPS(unittest.TestCase):
def setUp(self):
@@ -95,11 +75,10 @@ class TestHTTPS(unittest.TestCase):
self.server_thread.start()
def test_nocheckcertificate(self):
- if sys.version_info >= (2, 7, 9): # No certificate checking anyways
- ydl = YoutubeDL({'logger': FakeLogger()})
- self.assertRaises(
- Exception,
- ydl.extract_info, 'https://127.0.0.1:%d/video.html' % self.port)
+ ydl = YoutubeDL({'logger': FakeLogger()})
+ self.assertRaises(
+ Exception,
+ ydl.extract_info, 'https://127.0.0.1:%d/video.html' % self.port)
ydl = YoutubeDL({'logger': FakeLogger(), 'nocheckcertificate': True})
r = ydl.extract_info('https://127.0.0.1:%d/video.html' % self.port)