[Python-checkins] r50716 - python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py
jackilyn.hoxworth
python-checkins at python.org
Wed Jul 19 22:00:41 CEST 2006
Author: jackilyn.hoxworth
Date: Wed Jul 19 22:00:40 2006
New Revision: 50716
Modified:
python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py
Log:
I'm still not finished yet.
Modified: python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py
==============================================================================
--- python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py (original)
+++ python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py Wed Jul 19 22:00:40 2006
@@ -30,17 +30,30 @@
log.addHandler(handler)
# create socket
-sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+class FakeSocket:
+ def __init__(self, text, fileclass=StringIO.StringIO):
+ self.text = text
+ self.fileclass = fileclass
+
+ def makefile(self, mode, bufsize=None):
+ if mode != 'r' and mode != 'rb':
+ raise httplib.UnimplementedFileMode()
+ return self.fileclass(self.text)
+
+sock = FakeSocket("socket")
httplib._log.info("message 1") # first stage of testing
r = httplib.HTTPResponse(sock) # second stage of testing
r.begin() # call the begin method
-"""self.msg == None
-self._read_status == "message 1" == CONTINUE
-skip != True
-self.debuglevel > 0"""
+# class test:
+# def someTest:
+# self.msg == None
+# self._read_status == "message 1" == CONTINUE
+# skip != True
+# self.debuglevel > 0
+
print stringLog.getvalue() # For testing purposes
More information about the Python-checkins
mailing list