[issue6582] test_telnetlib doesn't test Telnet.write
Jack Diederich
report at bugs.python.org
Mon Jul 27 01:26:07 CEST 2009
Jack Diederich <jackdied at gmail.com> added the comment:
Marking as easy. What needs to be done is to add a small fake socket
class that redefines socket.sendall(self, bytes) to capture the args to
sock.sendall so it can be assertEqual'd to the expected bytes.
class SocketSendall(socket.socket):
_raw_sent = b''
def sendall(self, data):
self._raw_sent += data
class TelnetSockSendall(telnetlib.Telnet):
def open(self, *args, **opts):
''' a near-exact copy of Telnet.open '''
# copy 5 lines from Telnet.open here
self.sock = SocketSendall(*args, **opts)
then add a unit test that checks the ONLY thing Telnet.write() does,
which is change IAC to IAC+IAC.
----------
components: +Tests
keywords: +easy
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6582>
_______________________________________
More information about the Python-bugs-list
mailing list