This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_telnetlib doesn't test Telnet.write
Type: Stage:
Components: Tests Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: jackdied Nosy List: jackdied, rwanderley
Priority: normal Keywords: easy, patch

Created on 2009-07-26 22:30 by jackdied, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
telnetlib_writetest.diff rwanderley, 2009-08-10 21:54
Messages (6)
msg90963 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-07-26 22:30
test/test_telnetlib.py has zero tests for the telnetlib.Telnet.write method.
msg90967 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-07-26 23:26
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.
msg91361 - (view) Author: Rodrigo Steinmuller Wanderley (rwanderley) Date: 2009-08-06 13:42
Did only minor modifications to TelnetSocketSendall class.

Please review the following patch.
msg91498 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-08-12 15:51
Thanks Rodrigo,  I'll integrate this and check it in.
msg92218 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2009-09-03 20:38
applied in r74638
and I've added you to Misc/ACKS
Thanks again for the patch!
msg92220 - (view) Author: Rodrigo Steinmuller Wanderley (rwanderley) Date: 2009-09-03 21:04
On Thu, 03 Sep 2009 20:38:49 +0000
Jack Diederich <report@bugs.python.org> wrote:

> 
> Jack Diederich <jackdied@gmail.com> added the comment:
> 
> applied in r74638
> and I've added you to Misc/ACKS
> Thanks again for the patch!

No problem,

Anything I can do to improve telnetlib further?

I'm currently with plenty of time available and would appreciate the
opportunity to learn more Python.

Rodrigo

> ----------
> resolution:  -> accepted
> status: open -> closed
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue6582>
> _______________________________________
History
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50831
2009-09-03 21:04:46rwanderleysetmessages: + msg92220
2009-09-03 20:38:47jackdiedsetstatus: open -> closed
resolution: accepted
messages: + msg92218
2009-08-12 15:51:23jackdiedsetmessages: + msg91498
2009-08-10 21:54:36rwanderleysetfiles: + telnetlib_writetest.diff
2009-08-10 21:53:34rwanderleysetfiles: - write_test.patch
2009-08-06 13:42:04rwanderleysetfiles: + write_test.patch

nosy: + rwanderley
messages: + msg91361

keywords: + patch
2009-07-26 23:26:05jackdiedsetkeywords: + easy
messages: + msg90967
components: + Tests
2009-07-26 22:30:31jackdiedcreate