mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Fix test for new version of urllib that uses HTTPConnection directly.
Changes the way the httplib classes are stubbed out.
This commit is contained in:
parent
39b198d835
commit
77553ab531
1 changed files with 3 additions and 3 deletions
|
@ -111,11 +111,11 @@ class urlopen_HttpTests(unittest.TestCase):
|
||||||
class FakeHTTPConnection(httplib.HTTPConnection):
|
class FakeHTTPConnection(httplib.HTTPConnection):
|
||||||
def connect(self):
|
def connect(self):
|
||||||
self.sock = FakeSocket(fakedata)
|
self.sock = FakeSocket(fakedata)
|
||||||
assert httplib.HTTP._connection_class == httplib.HTTPConnection
|
self._connection_class = httplib.HTTPConnection
|
||||||
httplib.HTTP._connection_class = FakeHTTPConnection
|
httplib.HTTPConnection = FakeHTTPConnection
|
||||||
|
|
||||||
def unfakehttp(self):
|
def unfakehttp(self):
|
||||||
httplib.HTTP._connection_class = httplib.HTTPConnection
|
httplib.HTTPConnection = self._connection_class
|
||||||
|
|
||||||
def test_read(self):
|
def test_read(self):
|
||||||
self.fakehttp(b"Hello!")
|
self.fakehttp(b"Hello!")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue