From 83fda3c000a680317cfc9bb6fec899beb8bca773 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 30 Jan 2015 02:57:37 +0100 Subject: [PATCH] Add a test for --no-check-certificate --- test/test_http.py | 71 ++++++++++++++++++++++++++++++++++++++++++++ test/testcert.pem | 52 ++++++++++++++++++++++++++++++++ youtube_dl/compat.py | 6 ++++ 3 files changed, 129 insertions(+) create mode 100644 test/test_http.py create mode 100644 test/testcert.pem diff --git a/test/test_http.py b/test/test_http.py new file mode 100644 index 000000000..5cce5b3ae --- /dev/null +++ b/test/test_http.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +from __future__ import unicode_literals + +# Allow direct execution +import os +import sys +import unittest +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +from youtube_dl import YoutubeDL +from youtube_dl.compat import compat_http_server +import ssl +import threading + +TEST_DIR = os.path.dirname(os.path.abspath(__file__)) + +class HTTPTestRequestHandler(compat_http_server.BaseHTTPRequestHandler): + def log_message(self, format, *args): + pass + + def do_GET(self): + if self.path == '/video.html': + self.send_response(200) + self.send_header('Content-Type', 'text/html; charset=utf-8') + self.end_headers() + self.wfile.write(b'