bpo-28707: Add the directory parameter to http.server.SimpleHTTPRequestHandler and http.server module (#1776)

* bpo-28707: call the constructor of SimpleHTTPRequestHandler in the test with a mock object

* bpo-28707: Add the directory parameter to http.server.SimpleHTTPRequestHandler and http.server module
This commit is contained in:
Stéphane Wirtel 2017-05-24 09:29:06 +02:00 committed by Victor Stinner
parent 07244a8301
commit a17a2f52c4
4 changed files with 37 additions and 5 deletions

View file

@ -22,6 +22,7 @@ import urllib.parse
import tempfile
import time
import datetime
from unittest import mock
from io import BytesIO
import unittest
@ -782,7 +783,11 @@ class CGIHTTPServerTestCase(BaseTestCase):
class SocketlessRequestHandler(SimpleHTTPRequestHandler):
def __init__(self):
def __init__(self, *args, **kwargs):
request = mock.Mock()
request.makefile.return_value = BytesIO()
super().__init__(request, None, None)
self.get_called = False
self.protocol_version = "HTTP/1.1"