mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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):
|
||||
def connect(self):
|
||||
self.sock = FakeSocket(fakedata)
|
||||
assert httplib.HTTP._connection_class == httplib.HTTPConnection
|
||||
httplib.HTTP._connection_class = FakeHTTPConnection
|
||||
self._connection_class = httplib.HTTPConnection
|
||||
httplib.HTTPConnection = FakeHTTPConnection
|
||||
|
||||
def unfakehttp(self):
|
||||
httplib.HTTP._connection_class = httplib.HTTPConnection
|
||||
httplib.HTTPConnection = self._connection_class
|
||||
|
||||
def test_read(self):
|
||||
self.fakehttp(b"Hello!")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue