diff -Nru twisted-conch-11.0.0/bin/cftp twisted-conch-11.1.0/bin/cftp --- twisted-conch-11.0.0/bin/cftp 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/bin/cftp 2011-06-30 12:57:11.000000000 +0000 @@ -1,20 +1,15 @@ #!/usr/bin/env python - # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. - -### Twisted Preamble -# This makes sure that users don't have to set up their environment -# specially in order to run these programs from bin/. import sys, os -path = os.path.abspath(sys.argv[0]) -while os.path.dirname(path) != path: - if os.path.basename(path).startswith('Twisted'): - sys.path.insert(0, path) - break - path = os.path.dirname(path) -### end of preamble +extra = os.path.dirname(os.path.dirname(sys.argv[0])) +sys.path.insert(0, extra) +try: + import _preamble +except ImportError: + sys.exc_clear() +sys.path.remove(extra) from twisted.conch.scripts.cftp import run run() diff -Nru twisted-conch-11.0.0/bin/ckeygen twisted-conch-11.1.0/bin/ckeygen --- twisted-conch-11.0.0/bin/ckeygen 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/bin/ckeygen 2011-06-30 12:57:11.000000000 +0000 @@ -1,20 +1,15 @@ #!/usr/bin/env python - # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. - -### Twisted Preamble -# This makes sure that users don't have to set up their environment -# specially in order to run these programs from bin/. import sys, os -path = os.path.abspath(sys.argv[0]) -while os.path.dirname(path) != path: - if os.path.basename(path).startswith('Twisted'): - sys.path.insert(0, path) - break - path = os.path.dirname(path) -### end of preamble +extra = os.path.dirname(os.path.dirname(sys.argv[0])) +sys.path.insert(0, extra) +try: + import _preamble +except ImportError: + sys.exc_clear() +sys.path.remove(extra) from twisted.conch.scripts.ckeygen import run run() diff -Nru twisted-conch-11.0.0/bin/conch twisted-conch-11.1.0/bin/conch --- twisted-conch-11.0.0/bin/conch 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/bin/conch 2011-06-30 12:57:11.000000000 +0000 @@ -1,20 +1,15 @@ #!/usr/bin/env python - # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. - -### Twisted Preamble -# This makes sure that users don't have to set up their environment -# specially in order to run these programs from bin/. import sys, os -path = os.path.abspath(sys.argv[0]) -while os.path.dirname(path) != path: - if os.path.basename(path).startswith('Twisted'): - sys.path.insert(0, path) - break - path = os.path.dirname(path) -### end of preamble +extra = os.path.dirname(os.path.dirname(sys.argv[0])) +sys.path.insert(0, extra) +try: + import _preamble +except ImportError: + sys.exc_clear() +sys.path.remove(extra) from twisted.conch.scripts.conch import run run() diff -Nru twisted-conch-11.0.0/bin/tkconch twisted-conch-11.1.0/bin/tkconch --- twisted-conch-11.0.0/bin/tkconch 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/bin/tkconch 2011-06-30 12:57:11.000000000 +0000 @@ -1,20 +1,15 @@ #!/usr/bin/env python - # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. - -### Twisted Preamble -# This makes sure that users don't have to set up their environment -# specially in order to run these programs from bin/. import sys, os -path = os.path.abspath(sys.argv[0]) -while os.path.dirname(path) != path: - if os.path.basename(path).startswith('Twisted'): - sys.path.insert(0, path) - break - path = os.path.dirname(path) -### end of preamble +extra = os.path.dirname(os.path.dirname(sys.argv[0])) +sys.path.insert(0, extra) +try: + import _preamble +except ImportError: + sys.exc_clear() +sys.path.remove(extra) from twisted.conch.scripts.tkconch import run run() diff -Nru twisted-conch-11.0.0/debian/changelog twisted-conch-11.1.0/debian/changelog --- twisted-conch-11.0.0/debian/changelog 2011-04-18 20:32:06.000000000 +0000 +++ twisted-conch-11.1.0/debian/changelog 2012-01-20 01:30:18.000000000 +0000 @@ -1,3 +1,15 @@ +twisted-conch (1:11.1.0-1~ppa1~oneiric1) oneiric; urgency=low + + * Rebuild package for use in PPA. + + -- Jessica McKellar Thu, 19 Jan 2012 20:29:33 -0500 + +twisted-conch (1:11.1.0-1) unstable; urgency=low + + * New upstream version. + + -- Matthias Klose Wed, 21 Dec 2011 12:44:30 +0100 + twisted-conch (1:11.0.0-1) unstable; urgency=low * New upstream version. diff -Nru twisted-conch-11.0.0/debian/control twisted-conch-11.1.0/debian/control --- twisted-conch-11.0.0/debian/control 2011-04-18 20:33:48.000000000 +0000 +++ twisted-conch-11.1.0/debian/control 2012-01-20 01:28:51.000000000 +0000 @@ -4,14 +4,14 @@ Maintainer: Matthias Klose Uploaders: Free Ekanayaka Build-Depends: debhelper (>= 5.0.37.2), patch -Build-Depends-Indep: python-all (>= 2.6.5-9~), python-twisted-core (>= 11.0) +Build-Depends-Indep: python-all (>= 2.6.5-9~), python-twisted-core (>= 11.1) Build-Conflicts: python-setuptools XS-Python-Version: all Standards-Version: 3.9.1 Package: python-twisted-conch Architecture: all -Depends: ${python:Depends}, python-crypto (>= 2.0.1+dfsg1-1.1), python-pyasn1, python-twisted-core (>= 11.0), ${misc:Depends} +Depends: ${python:Depends}, python-crypto (>= 2.0.1+dfsg1-1.1), python-pyasn1, python-twisted-core (>= 11.1), ${misc:Depends} Provides: conch, ${python:Provides} Conflicts: python2.3-twisted (<< 2.2), python2.3-twisted-conch, python2.4-twisted-conch Replaces: python2.3-twisted (<< 2.2), python2.3-twisted-conch, python2.4-twisted-conch diff -Nru twisted-conch-11.0.0/doc/examples/index.html twisted-conch-11.1.0/doc/examples/index.html --- twisted-conch-11.0.0/doc/examples/index.html 2011-04-02 01:47:21.000000000 +0000 +++ twisted-conch-11.1.0/doc/examples/index.html 2011-11-17 10:51:13.000000000 +0000 @@ -35,6 +35,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/howto/conch_client.html twisted-conch-11.1.0/doc/howto/conch_client.html --- twisted-conch-11.0.0/doc/howto/conch_client.html 2011-04-02 01:47:22.000000000 +0000 +++ twisted-conch-11.1.0/doc/howto/conch_client.html 2011-11-17 10:51:13.000000000 +0000 @@ -20,7 +20,7 @@

Writing a client

-

Writing a client with Conch involves sub-classing 4 classes: twisted.conch.ssh.transport.SSHClientTransport, twisted.conch.ssh.userauth.SSHUserAuthClient, twisted.conch.ssh.connection.SSHConnection, and twisted.conch.ssh.channel.SSHChannel. We'll start out +

Writing a client with Conch involves sub-classing 4 classes: twisted.conch.ssh.transport.SSHClientTransport, twisted.conch.ssh.userauth.SSHUserAuthClient, twisted.conch.ssh.connection.SSHConnection, and twisted.conch.ssh.channel.SSHChannel. We'll start out with SSHClientTransport because it's the base of the client.

@@ -63,7 +63,7 @@ is called with two strings: the public key sent by the server and its fingerprint. You should verify the host key the server sends, either by checking against a hard-coded value as in the example, or by asking -the user. verifyHostKey returns a twisted.internet.defer.Deferred which gets a callback +the user. verifyHostKey returns a twisted.internet.defer.Deferred which gets a callback if the host key is valid, or an errback if it is not. Note that in the above, replace 'user' with the username you're attempting to ssh with, for instance a call to os.getlogin() for the @@ -249,14 +249,14 @@ send the request for this channel. The 2nd argument of 'exec' tells the server that we want to execute a command. The third argument is the data that accompanies the request. -common.NS encodes +common.NS encodes the data as a length-prefixed string, which is how the server expects the data. We also say that we want a reply saying that the process has a been started. sendRequest() then returns a Deferred which we add a callback for.

Once the callback fires, we send the data. SSHChannel supports the -twisted.internet.interfaces.ITransport +twisted.internet.interfaces.ITransport interface, so it can be given to Protocols to run them over the secure connection. In our case, we just write the data directly. sendEOF() does not follow the interface, @@ -294,7 +294,7 @@

We call connectTCP() to connect to localhost, port 22 (the standard port for ssh), and pass it an instance -of twisted.internet.protocol.ClientFactory. +of twisted.internet.protocol.ClientFactory. This instance has the attribute protocol set to our earlier ClientTransport class. Note that the protocol attribute is set to the class ClientTransport, not an instance of @@ -316,6 +316,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/howto/index.html twisted-conch-11.1.0/doc/howto/index.html --- twisted-conch-11.0.0/doc/howto/index.html 2011-04-02 01:47:22.000000000 +0000 +++ twisted-conch-11.1.0/doc/howto/index.html 2011-11-17 10:51:13.000000000 +0000 @@ -23,6 +23,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/index.html twisted-conch-11.1.0/doc/index.html --- twisted-conch-11.0.0/doc/index.html 2011-04-02 01:47:21.000000000 +0000 +++ twisted-conch-11.1.0/doc/index.html 2011-11-17 10:51:13.000000000 +0000 @@ -20,6 +20,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/man/cftp-man.html twisted-conch-11.1.0/doc/man/cftp-man.html --- twisted-conch-11.0.0/doc/man/cftp-man.html 2011-04-02 01:47:22.000000000 +0000 +++ twisted-conch-11.1.0/doc/man/cftp-man.html 2011-11-17 10:51:13.000000000 +0000 @@ -82,6 +82,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/man/ckeygen-man.html twisted-conch-11.1.0/doc/man/ckeygen-man.html --- twisted-conch-11.0.0/doc/man/ckeygen-man.html 2011-04-02 01:47:22.000000000 +0000 +++ twisted-conch-11.1.0/doc/man/ckeygen-man.html 2011-11-17 10:51:13.000000000 +0000 @@ -102,6 +102,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/man/conch-man.html twisted-conch-11.1.0/doc/man/conch-man.html --- twisted-conch-11.0.0/doc/man/conch-man.html 2011-04-02 01:47:22.000000000 +0000 +++ twisted-conch-11.1.0/doc/man/conch-man.html 2011-11-17 10:51:13.000000000 +0000 @@ -143,6 +143,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/doc/man/tkconch-man.html twisted-conch-11.1.0/doc/man/tkconch-man.html --- twisted-conch-11.0.0/doc/man/tkconch-man.html 2011-04-02 01:47:22.000000000 +0000 +++ twisted-conch-11.1.0/doc/man/tkconch-man.html 2011-11-17 10:51:13.000000000 +0000 @@ -124,6 +124,6 @@

Index

- Version: 11.0.0 + Version: 11.1.0 \ No newline at end of file diff -Nru twisted-conch-11.0.0/LICENSE twisted-conch-11.1.0/LICENSE --- twisted-conch-11.0.0/LICENSE 2011-03-22 23:04:17.000000000 +0000 +++ twisted-conch-11.1.0/LICENSE 2011-05-05 02:48:02.000000000 +0000 @@ -12,7 +12,7 @@ Donovan Preston Eric Mangold Eyal Lotem -Itamar Shtull-Trauring +Itamar Turner-Trauring James Knight Jason A. Mobarak Jean-Paul Calderone diff -Nru twisted-conch-11.0.0/NEWS twisted-conch-11.1.0/NEWS --- twisted-conch-11.0.0/NEWS 2011-04-02 01:10:15.000000000 +0000 +++ twisted-conch-11.1.0/NEWS 2011-11-15 16:39:18.000000000 +0000 @@ -1,6 +1,45 @@ Ticket numbers in this file can be looked up by visiting http://twistedmatrix.com/trac/ticket/ +Twisted Conch 11.1.0 (2011-11-15) +================================= + +Features +-------- + - twisted.conch.ssh.filetransfer.FileTransferClient now handles short + status messages, not strictly allowed by the RFC, but sent by some + SSH implementations. (#3009) + - twisted.conch.manhole now supports CTRL-A and CTRL-E to trigger + HOME and END functions respectively. (#5252) + +Bugfixes +-------- + - When run from an unpacked source tarball or a VCS checkout, the + bin/conch/ scripts will now use the version of Twisted they are + part of. (#3526) + - twisted.conch.insults.window.ScrolledArea now passes no extra + arguments to object.__init__ (which works on more versions of + Python). (#4197) + - twisted.conch.telnet.ITelnetProtocol now has the correct signature + for its unhandledSubnegotiation() method. (#4751) + - twisted.conch.ssh.userauth.SSHUserAuthClient now more closely + follows the RFC 4251 definition of boolean values when negotiating + for key-based authentication, allowing better interoperability with + other SSH implementations. (#5241) + - twisted.conch.recvline.RecvLine now ignores certain function keys + in its keystrokeReceived method instead of raising an exception. + (#5246) + +Deprecations and Removals +------------------------- + - The --user option to `twistd manhole' has been removed as it was + dead code with no functionality associated with it. (#5283) + +Other +----- + - #5107, #5256, #5349 + + Twisted Conch 11.0.0 (2011-04-01) ================================= diff -Nru twisted-conch-11.0.0/README twisted-conch-11.1.0/README --- twisted-conch-11.0.0/README 2011-04-02 01:10:15.000000000 +0000 +++ twisted-conch-11.1.0/README 2011-11-15 16:39:18.000000000 +0000 @@ -1,4 +1,4 @@ -Twisted Conch 11.0.0 +Twisted Conch 11.1.0 Twisted Conch depends on Twisted Core and on Python Crypto extensions (). diff -Nru twisted-conch-11.0.0/twisted/conch/client/options.py twisted-conch-11.1.0/twisted/conch/client/options.py --- twisted-conch-11.0.0/twisted/conch/client/options.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/client/options.py 2011-10-18 10:31:11.000000000 +0000 @@ -29,26 +29,32 @@ ['noagent', 'a', 'Disable authentication agent forwarding (default)'], ['reconnect', 'r', 'Reconnect to the server if the connection is lost.'], ] - zsh_altArgDescr = {"connection-usage":"Connection types to use"} - #zsh_multiUse = ["foo", "bar"] - zsh_mutuallyExclusive = [("agent", "noagent")] - zsh_actions = {"user":"_users", - "ciphers":"_values -s , 'ciphers to choose from' %s" % - " ".join(SSHCiphers.cipherMap.keys()), - "macs":"_values -s , 'macs to choose from' %s" % - " ".join(SSHCiphers.macMap.keys()), - "host-key-algorithms":"_values -s , 'host key algorithms to choose from' %s" % - " ".join(SSHClientTransport.supportedPublicKeys), - #"user-authentications":"_values -s , 'user authentication types to choose from' %s" % - # " ".join(???), - } - #zsh_actionDescr = {"logfile":"log file name", "random":"random seed"} - # user, host, or user@host completion similar to zsh's ssh completion - zsh_extras = ['1:host | user@host:{_ssh;if compset -P "*@"; then _wanted hosts expl "remote host name" _ssh_hosts && ret=0 elif compset -S "@*"; then _wanted users expl "login name" _ssh_users -S "" && ret=0 else if (( $+opt_args[-l] )); then tmp=() else tmp=( "users:login name:_ssh_users -qS@" ) fi; _alternative "hosts:remote host name:_ssh_hosts" "$tmp[@]" && ret=0 fi}'] + + compData = usage.Completions( + mutuallyExclusive=[("agent", "noagent")], + optActions={ + "user": usage.CompleteUsernames(), + "ciphers": usage.CompleteMultiList( + SSHCiphers.cipherMap.keys(), + descr='ciphers to choose from'), + "macs": usage.CompleteMultiList( + SSHCiphers.macMap.keys(), + descr='macs to choose from'), + "host-key-algorithms": usage.CompleteMultiList( + SSHClientTransport.supportedPublicKeys, + descr='host key algorithms to choose from'), + #"user-authentications": usage.CompleteMultiList(? + # descr='user authentication types' ), + }, + extraActions=[usage.CompleteUserAtHost(), + usage.Completer(descr="command"), + usage.Completer(descr='argument', + repeat=True)] + ) def __init__(self, *args, **kw): usage.Options.__init__(self, *args, **kw) - self.identitys = [] + self.identitys = [] self.conns = None def opt_identity(self, i): diff -Nru twisted-conch-11.0.0/twisted/conch/insults/window.py twisted-conch-11.1.0/twisted/conch/insults/window.py --- twisted-conch-11.0.0/twisted/conch/insults/window.py 2008-07-29 20:13:54.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/insults/window.py 2011-05-15 14:25:06.000000000 +0000 @@ -729,8 +729,12 @@ class ScrolledArea(Widget): + """ + A L{ScrolledArea} contains another widget wrapped in a viewport and + vertical and horizontal scrollbars for moving the viewport around. + """ def __init__(self, containee): - Widget.__init__(self, containee) + Widget.__init__(self) self._viewport = Viewport(containee) self._horiz = HorizontalScrollbar(self._horizScroll) self._vert = VerticalScrollbar(self._vertScroll) diff -Nru twisted-conch-11.0.0/twisted/conch/manhole.py twisted-conch-11.1.0/twisted/conch/manhole.py --- twisted-conch-11.0.0/twisted/conch/manhole.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/manhole.py 2011-09-19 21:10:30.000000000 +0000 @@ -135,6 +135,8 @@ CTRL_D = '\x04' CTRL_BACKSLASH = '\x1c' CTRL_L = '\x0c' +CTRL_A = '\x01' +CTRL_E = '\x05' class Manhole(recvline.HistoricRecvLine): """Mediator between a fancy line source and an interactive interpreter. @@ -159,6 +161,8 @@ self.keyHandlers[CTRL_C] = self.handle_INT self.keyHandlers[CTRL_D] = self.handle_EOF self.keyHandlers[CTRL_L] = self.handle_FF + self.keyHandlers[CTRL_A] = self.handle_HOME + self.keyHandlers[CTRL_E] = self.handle_END self.keyHandlers[CTRL_BACKSLASH] = self.handle_QUIT diff -Nru twisted-conch-11.0.0/twisted/conch/manhole_tap.py twisted-conch-11.1.0/twisted/conch/manhole_tap.py --- twisted-conch-11.0.0/twisted/conch/manhole_tap.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/manhole_tap.py 2011-10-01 07:45:02.000000000 +0000 @@ -58,12 +58,8 @@ def __init__(self): usage.Options.__init__(self) - self.users = [] self['namespace'] = None - def opt_user(self, name): - self.users.append(name) - def postOptions(self): if self['telnetPort'] is None and self['sshPort'] is None: raise usage.UsageError("At least one of --telnetPort and --sshPort must be specified") diff -Nru twisted-conch-11.0.0/twisted/conch/recvline.py twisted-conch-11.1.0/twisted/conch/recvline.py --- twisted-conch-11.0.0/twisted/conch/recvline.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/recvline.py 2011-09-02 13:02:18.000000000 +0000 @@ -116,6 +116,7 @@ ps = ('>>> ', '... ') pn = 0 + _printableChars = set(string.printable) def connectionMade(self): # A list containing the characters making up the current line @@ -196,7 +197,7 @@ m = self.keyHandlers.get(keyID) if m is not None: m() - elif keyID in string.printable: + elif keyID in self._printableChars: self.characterReceived(keyID, False) else: log.msg("Received unhandled keyID: %r" % (keyID,)) diff -Nru twisted-conch-11.0.0/twisted/conch/scripts/cftp.py twisted-conch-11.1.0/twisted/conch/scripts/cftp.py --- twisted-conch-11.0.0/twisted/conch/scripts/cftp.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/scripts/cftp.py 2011-10-18 10:31:11.000000000 +0000 @@ -30,12 +30,12 @@ ['batchfile', 'b', None, 'File to read commands from, or \'-\' for stdin.'], ['requests', 'R', 5, 'Number of requests to make before waiting for a reply.'], ['subsystem', 's', 'sftp', 'Subsystem/server program to connect to.']] - zsh_altArgDescr = {"buffersize":"Size of send/receive buffer (default: 32768)"} - #zsh_multiUse = ["foo", "bar"] - #zsh_mutuallyExclusive = [("foo", "bar"), ("bar", "baz")] - #zsh_actions = {"foo":'_files -g "*.foo"', "bar":"(one two three)"} - #zsh_actionDescr = {"logfile":"log file name", "random":"random seed"} - zsh_extras = ['2::localfile:{if [[ $words[1] == *:* ]]; then; _files; fi}'] + + compData = usage.Completions( + descriptions={ + "buffersize": "Size of send/receive buffer (default: 32768)"}, + extraActions=[usage.CompleteUserAtHost(), + usage.CompleteFiles(descr="local file")]) def parseArgs(self, host, localPath=None): self['remotePath'] = '' diff -Nru twisted-conch-11.0.0/twisted/conch/scripts/ckeygen.py twisted-conch-11.1.0/twisted/conch/scripts/ckeygen.py --- twisted-conch-11.0.0/twisted/conch/scripts/ckeygen.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/scripts/ckeygen.py 2011-10-18 10:31:11.000000000 +0000 @@ -37,11 +37,8 @@ ['quiet', 'q', 'Quiet.'], ['showpub', 'y', 'Read private key file and print public key.']] - #zsh_altArgDescr = {"bits":"Number of bits in the key (default: 1024)"} - #zsh_multiUse = ["foo", "bar"] - #zsh_mutuallyExclusive = [("foo", "bar"), ("bar", "baz")] - zsh_actions = {"type":"(rsa dsa)"} - #zsh_actionDescr = {"logfile":"log file name", "random":"random seed"} + compData = usage.Completions( + optActions={"type": usage.CompleteList(["rsa", "dsa"])}) def run(): options = GeneralOptions() diff -Nru twisted-conch-11.0.0/twisted/conch/scripts/conch.py twisted-conch-11.1.0/twisted/conch/scripts/conch.py --- twisted-conch-11.0.0/twisted/conch/scripts/conch.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/scripts/conch.py 2011-10-18 10:31:11.000000000 +0000 @@ -37,13 +37,15 @@ ['subsystem', 's', 'Invoke command (mandatory) as SSH2 subsystem.'], ] - #zsh_altArgDescr = {"foo":"use this description for foo instead"} - #zsh_multiUse = ["foo", "bar"] - #zsh_mutuallyExclusive = [("foo", "bar"), ("bar", "baz")] - #zsh_actions = {"foo":'_files -g "*.foo"', "bar":"(one two three)"} - zsh_actionDescr = {"localforward":"listen-port:host:port", - "remoteforward":"listen-port:host:port"} - zsh_extras = ["*:command: "] + compData = usage.Completions( + mutuallyExclusive=[("tty", "notty")], + optActions={ + "localforward": usage.Completer(descr="listen-port:host:port"), + "remoteforward": usage.Completer(descr="listen-port:host:port")}, + extraActions=[usage.CompleteUserAtHost(), + usage.Completer(descr="command"), + usage.Completer(descr="argument", repeat=True)] + ) localForwards = [] remoteForwards = [] diff -Nru twisted-conch-11.0.0/twisted/conch/scripts/tkconch.py twisted-conch-11.1.0/twisted/conch/scripts/tkconch.py --- twisted-conch-11.0.0/twisted/conch/scripts/tkconch.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/scripts/tkconch.py 2011-10-18 10:31:11.000000000 +0000 @@ -192,7 +192,7 @@ ['localforward', 'L', None, 'listen-port:host:port Forward local port to remote address'], ['remoteforward', 'R', None, 'listen-port:host:port Forward remote port to local address'], ] - + optFlags = [['tty', 't', 'Tty; allocate a tty even if command is given.'], ['notty', 'T', 'Do not allocate a tty.'], ['version', 'V', 'Display version number only.'], @@ -202,16 +202,20 @@ ['log', 'v', 'Log to stderr'], ['ansilog', 'a', 'Print the receieved data to stdout']] - #zsh_altArgDescr = {"foo":"use this description for foo instead"} - #zsh_multiUse = ["foo", "bar"] - zsh_mutuallyExclusive = [("tty", "notty")] - zsh_actions = {"cipher":"(%s)" % " ".join(transport.SSHClientTransport.supportedCiphers), - "macs":"(%s)" % " ".join(transport.SSHClientTransport.supportedMACs)} - zsh_actionDescr = {"localforward":"listen-port:host:port", - "remoteforward":"listen-port:host:port"} - # user, host, or user@host completion similar to zsh's ssh completion - zsh_extras = ['1:host | user@host:{_ssh;if compset -P "*@"; then _wanted hosts expl "remote host name" _ssh_hosts && ret=0 elif compset -S "@*"; then _wanted users expl "login name" _ssh_users -S "" && ret=0 else if (( $+opt_args[-l] )); then tmp=() else tmp=( "users:login name:_ssh_users -qS@" ) fi; _alternative "hosts:remote host name:_ssh_hosts" "$tmp[@]" && ret=0 fi}', - '*:command: '] + _ciphers = transport.SSHClientTransport.supportedCiphers + _macs = transport.SSHClientTransport.supportedMACs + + compData = usage.Completions( + mutuallyExclusive=[("tty", "notty")], + optActions={ + "cipher": usage.CompleteList(_ciphers), + "macs": usage.CompleteList(_macs), + "localforward": usage.Completer(descr="listen-port:host:port"), + "remoteforward": usage.Completer(descr="listen-port:host:port")}, + extraActions=[usage.CompleteUserAtHost(), + usage.Completer(descr="command"), + usage.Completer(descr="argument", repeat=True)] + ) identitys = [] localForwards = [] diff -Nru twisted-conch-11.0.0/twisted/conch/ssh/filetransfer.py twisted-conch-11.1.0/twisted/conch/ssh/filetransfer.py --- twisted-conch-11.0.0/twisted/conch/ssh/filetransfer.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/ssh/filetransfer.py 2011-09-09 17:48:29.000000000 +0000 @@ -708,8 +708,15 @@ d, data = self._parseRequest(data) code, = struct.unpack('!L', data[:4]) data = data[4:] - msg, data = getNS(data) - lang = getNS(data) + if len(data) >= 4: + msg, data = getNS(data) + if len(data) >= 4: + lang, data = getNS(data) + else: + lang = '' + else: + msg = '' + lang = '' if code == FX_OK: d.callback((msg, lang)) elif code == FX_EOF: diff -Nru twisted-conch-11.0.0/twisted/conch/ssh/keys.py twisted-conch-11.1.0/twisted/conch/ssh/keys.py --- twisted-conch-11.0.0/twisted/conch/ssh/keys.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/ssh/keys.py 2011-11-01 21:37:17.000000000 +0000 @@ -461,9 +461,9 @@ 'RSA' or 'DSA'. """ # the class is Crypto.PublicKey.. - klass = str(self.keyObject.__class__) - if klass.startswith('Crypto.PublicKey'): - type = klass.split('.')[2] + mod = self.keyObject.__class__.__module__ + if mod.startswith('Crypto.PublicKey'): + type = mod.split('.')[2] else: raise RuntimeError('unknown type of object: %r' % self.keyObject) if type in ('RSA', 'DSA'): diff -Nru twisted-conch-11.0.0/twisted/conch/ssh/userauth.py twisted-conch-11.1.0/twisted/conch/ssh/userauth.py --- twisted-conch-11.0.0/twisted/conch/ssh/userauth.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/ssh/userauth.py 2011-08-26 14:19:19.000000000 +0000 @@ -564,7 +564,7 @@ publicKey = self.lastPublicKey b = (NS(self.transport.sessionID) + chr(MSG_USERAUTH_REQUEST) + NS(self.user) + NS(self.instance.name) + NS('publickey') + - '\xff' + NS(publicKey.sshType()) + NS(publicKey.blob())) + '\x01' + NS(publicKey.sshType()) + NS(publicKey.blob())) d = self.signData(publicKey, b) if not d: self.askForAuth('none', '') @@ -617,7 +617,7 @@ @type signedData: C{str} """ publicKey = self.lastPublicKey - self.askForAuth('publickey', '\xff' + NS(publicKey.sshType()) + + self.askForAuth('publickey', '\x01' + NS(publicKey.sshType()) + NS(publicKey.blob()) + NS(signedData)) diff -Nru twisted-conch-11.0.0/twisted/conch/tap.py twisted-conch-11.1.0/twisted/conch/tap.py --- twisted-conch-11.0.0/twisted/conch/tap.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/tap.py 2011-10-18 10:31:11.000000000 +0000 @@ -28,7 +28,11 @@ ["moduli", "", None, "directory to look for moduli in " "(if different from --data)"] ] - zsh_actions = {"data" : "_dirs", "moduli" : "_dirs"} + compData = usage.Completions( + optActions={"data" : usage.CompleteDirs(descr="data directory"), + "moduli" : usage.CompleteDirs(descr="moduli directory"), + "interface" : usage.CompleteNetInterfaces()} + ) def makeService(config): diff -Nru twisted-conch-11.0.0/twisted/conch/telnet.py twisted-conch-11.1.0/twisted/conch/telnet.py --- twisted-conch-11.0.0/twisted/conch/telnet.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/telnet.py 2011-10-01 08:11:41.000000000 +0000 @@ -155,10 +155,23 @@ class ITelnetProtocol(iinternet.IProtocol): def unhandledCommand(command, argument): """A command was received but not understood. + + @param command: the command received. + @type command: C{str}, a single character. + @param argument: the argument to the received command. + @type argument: C{str}, a single character, or None if the command that + was unhandled does not provide an argument. """ - def unhandledSubnegotiation(bytes): + def unhandledSubnegotiation(command, bytes): """A subnegotiation command was received but not understood. + + @param command: the command being subnegotiated. That is, the first + byte after the SB command. + @type command: C{str}, a single character. + @param bytes: all other bytes of the subneogation. That is, all but the + first bytes between SB and SE, with IAC un-escaping applied. + @type bytes: C{list} of C{str}, each a single character """ def enableLocal(option): @@ -168,6 +181,9 @@ telnet connection and return True. If False is returned, the option will be treated as still disabled and the peer will be notified. + + @param option: the option to be enabled. + @type option: C{str}, a single character. """ def enableRemote(option): @@ -175,6 +191,9 @@ Returns True if the peer should be allowed to enable this option, False otherwise. + + @param option: the option to be enabled. + @type option: C{str}, a single character. """ def disableLocal(option): @@ -182,10 +201,16 @@ Unlike enableLocal, this method cannot fail. The option must be disabled. + + @param option: the option to be disabled. + @type option: C{str}, a single character. """ def disableRemote(option): """Indicate that the peer has disabled this option. + + @param option: the option to be disabled. + @type option: C{str}, a single character. """ diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_agent.py twisted-conch-11.1.0/twisted/conch/test/test_agent.py --- twisted-conch-11.0.0/twisted/conch/test/test_agent.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_agent.py 2011-07-14 19:05:14.000000000 +0000 @@ -309,7 +309,7 @@ def _check(sig): # Cannot do this b/c DSA uses random numbers when signing # expected = self.dsaPrivate.sign("John Hancock") - # self.assertEquals(expected, sig) + # self.assertEqual(expected, sig) self.assertTrue(self.dsaPublic.verify(sig, "John Hancock")) return d.addCallback(_check) @@ -340,7 +340,7 @@ received = {} for k in keyt: received[keys.Key.fromString(k[0], type='blob').blob()] = k[1] - self.assertEquals(expected, received) + self.assertEqual(expected, received) return d.addCallback(_check) @@ -395,5 +395,5 @@ self.pump.flush() def _check(ignored): - self.assertEquals(0, len(self.server.factory.keys)) + self.assertEqual(0, len(self.server.factory.keys)) return d.addCallback(_check) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_cftp.py twisted-conch-11.1.0/twisted/conch/test/test_cftp.py --- twisted-conch-11.0.0/twisted/conch/test/test_cftp.py 2011-03-15 16:35:19.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_cftp.py 2011-07-14 19:05:14.000000000 +0000 @@ -156,10 +156,10 @@ locale.setlocale(locale.LC_ALL, "es_AR.UTF8") self.addCleanup(locale.setlocale, locale.LC_ALL, currentLocale) - self.assertEquals( + self.assertEqual( self._lsInTimezone('America/New_York', stat), '!--------- 0 0 0 0 Aug 28 17:33 foo') - self.assertEquals( + self.assertEqual( self._lsInTimezone('Pacific/Auckland', stat), '!--------- 0 0 0 0 Aug 29 09:33 foo') @@ -229,7 +229,7 @@ sys.executable) d = self.client._dispatchCommand("exec print 1 + 2") - d.addCallback(self.assertEquals, "3\n") + d.addCallback(self.assertEqual, "3\n") return d @@ -242,7 +242,7 @@ getpass.getuser(), 'secret', os.getuid(), 1234, 'foo', 'bar', '') d = self.client._dispatchCommand("exec echo hello") - d.addCallback(self.assertEquals, "hello\n") + d.addCallback(self.assertEqual, "hello\n") return d @@ -255,7 +255,7 @@ '/bin/sh') d = self.client._dispatchCommand("!echo hello") - d.addCallback(self.assertEquals, "hello\n") + d.addCallback(self.assertEqual, "hello\n") return d @@ -297,7 +297,7 @@ clock.advance(2.0) wrapper.total += 4096 self.client._printProgressBar(wrapper, startTime) - self.assertEquals(self.client.transport.value(), + self.assertEqual(self.client.transport.value(), "\rsample 40% 4.0kB 2.0kBps 00:03 ") @@ -314,7 +314,7 @@ wrapper = cftp.FileWrapper(wrapped) startTime = clock.seconds() self.client._printProgressBar(wrapper, startTime) - self.assertEquals(self.client.transport.value(), + self.assertEqual(self.client.transport.value(), "\rsample 0% 0.0B 0.0Bps 00:00 ") @@ -615,7 +615,7 @@ """ f1 = file(name1).read() f2 = file(name2).read() - self.failUnlessEqual(f1, f2, msg) + self.assertEqual(f1, f2, msg) def testGet(self): @@ -786,8 +786,8 @@ appropriate error, and doesn't log an useless error server side. """ def _check(results): - self.assertEquals(results[0], '') - self.assertEquals(results[1], + self.assertEqual(results[0], '') + self.assertEqual(results[1], 'remote error 11: mkdir failed') d = self.runScript('mkdir testMakeDirectory', @@ -875,7 +875,7 @@ res = res.split('\n') log.msg('RES %s' % str(res)) self.failUnless(res[1].find(self.testDir) != -1, repr(res)) - self.failUnlessEqual(res[3:-2], ['testDirectory', 'testRemoveFile', + self.assertEqual(res[3:-2], ['testDirectory', 'testRemoveFile', 'testRenameFile', 'testfile1']) d = self._getBatchOutput(cmds) @@ -954,7 +954,7 @@ '-o', 'Port=%i' % (port,), '-b', fn, 'testuser@127.0.0.1') d = getProcessOutputAndValue("sftp", cmds) def check(result): - self.assertEquals(result[2], 0) + self.assertEqual(result[2], 0) for i in ['testDirectory', 'testRemoveFile', 'testRenameFile', 'testfile1']: self.assertIn(i, result[0]) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_channel.py twisted-conch-11.1.0/twisted/conch/test/test_channel.py --- twisted-conch-11.0.0/twisted/conch/test/test_channel.py 2008-02-19 20:32:40.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_channel.py 2011-07-14 19:05:14.000000000 +0000 @@ -91,31 +91,31 @@ order. """ c = channel.SSHChannel(conn=self.conn) - self.assertEquals(c.localWindowSize, 131072) - self.assertEquals(c.localWindowLeft, 131072) - self.assertEquals(c.localMaxPacket, 32768) - self.assertEquals(c.remoteWindowLeft, 0) - self.assertEquals(c.remoteMaxPacket, 0) - self.assertEquals(c.conn, self.conn) - self.assertEquals(c.data, None) - self.assertEquals(c.avatar, None) + self.assertEqual(c.localWindowSize, 131072) + self.assertEqual(c.localWindowLeft, 131072) + self.assertEqual(c.localMaxPacket, 32768) + self.assertEqual(c.remoteWindowLeft, 0) + self.assertEqual(c.remoteMaxPacket, 0) + self.assertEqual(c.conn, self.conn) + self.assertEqual(c.data, None) + self.assertEqual(c.avatar, None) c2 = channel.SSHChannel(1, 2, 3, 4, 5, 6, 7) - self.assertEquals(c2.localWindowSize, 1) - self.assertEquals(c2.localWindowLeft, 1) - self.assertEquals(c2.localMaxPacket, 2) - self.assertEquals(c2.remoteWindowLeft, 3) - self.assertEquals(c2.remoteMaxPacket, 4) - self.assertEquals(c2.conn, 5) - self.assertEquals(c2.data, 6) - self.assertEquals(c2.avatar, 7) + self.assertEqual(c2.localWindowSize, 1) + self.assertEqual(c2.localWindowLeft, 1) + self.assertEqual(c2.localMaxPacket, 2) + self.assertEqual(c2.remoteWindowLeft, 3) + self.assertEqual(c2.remoteMaxPacket, 4) + self.assertEqual(c2.conn, 5) + self.assertEqual(c2.data, 6) + self.assertEqual(c2.avatar, 7) def test_str(self): """ Test that str(SSHChannel) works gives the channel name and local and remote windows at a glance.. """ - self.assertEquals(str(self.channel), '') def test_logPrefix(self): @@ -123,7 +123,7 @@ Test that SSHChannel.logPrefix gives the name of the channel, the local channel ID and the underlying connection. """ - self.assertEquals(self.channel.logPrefix(), 'SSHChannel channel ' + self.assertEqual(self.channel.logPrefix(), 'SSHChannel channel ' '(unknown) on MockConnection') def test_addWindowBytes(self): @@ -138,13 +138,13 @@ self.channel.write('test') self.channel.writeExtended(1, 'test') self.channel.addWindowBytes(50) - self.assertEquals(self.channel.remoteWindowLeft, 50 - 4 - 4) + self.assertEqual(self.channel.remoteWindowLeft, 50 - 4 - 4) self.assertTrue(self.channel.areWriting) self.assertTrue(cb[0]) - self.assertEquals(self.channel.buf, '') - self.assertEquals(self.conn.data[self.channel], ['test']) - self.assertEquals(self.channel.extBuf, []) - self.assertEquals(self.conn.extData[self.channel], [(1, 'test')]) + self.assertEqual(self.channel.buf, '') + self.assertEqual(self.conn.data[self.channel], ['test']) + self.assertEqual(self.channel.extBuf, []) + self.assertEqual(self.conn.extData[self.channel], [(1, 'test')]) cb[0] = False self.channel.addWindowBytes(20) @@ -192,20 +192,20 @@ self.channel.addWindowBytes(20) self.channel.write('ta') data = self.conn.data[self.channel] - self.assertEquals(data, ['da', 'ta']) - self.assertEquals(self.channel.remoteWindowLeft, 16) + self.assertEqual(data, ['da', 'ta']) + self.assertEqual(self.channel.remoteWindowLeft, 16) # larger than max packet self.channel.write('12345678901') - self.assertEquals(data, ['da', 'ta', '1234567890', '1']) - self.assertEquals(self.channel.remoteWindowLeft, 5) + self.assertEqual(data, ['da', 'ta', '1234567890', '1']) + self.assertEqual(self.channel.remoteWindowLeft, 5) # running out of window cb[0] = False self.channel.write('123456') self.assertFalse(self.channel.areWriting) self.assertTrue(cb[0]) - self.assertEquals(data, ['da', 'ta', '1234567890', '1', '12345']) - self.assertEquals(self.channel.buf, '6') - self.assertEquals(self.channel.remoteWindowLeft, 0) + self.assertEqual(data, ['da', 'ta', '1234567890', '1', '12345']) + self.assertEqual(self.channel.buf, '6') + self.assertEqual(self.channel.remoteWindowLeft, 0) def test_writeExtended(self): """ @@ -227,22 +227,22 @@ self.channel.addWindowBytes(20) self.channel.writeExtended(2, 'a') data = self.conn.extData[self.channel] - self.assertEquals(data, [(1, 'da'), (2, 't'), (2, 'a')]) - self.assertEquals(self.channel.remoteWindowLeft, 16) + self.assertEqual(data, [(1, 'da'), (2, 't'), (2, 'a')]) + self.assertEqual(self.channel.remoteWindowLeft, 16) # larger than max packet self.channel.writeExtended(3, '12345678901') - self.assertEquals(data, [(1, 'da'), (2, 't'), (2, 'a'), + self.assertEqual(data, [(1, 'da'), (2, 't'), (2, 'a'), (3, '1234567890'), (3, '1')]) - self.assertEquals(self.channel.remoteWindowLeft, 5) + self.assertEqual(self.channel.remoteWindowLeft, 5) # running out of window cb[0] = False self.channel.writeExtended(4, '123456') self.assertFalse(self.channel.areWriting) self.assertTrue(cb[0]) - self.assertEquals(data, [(1, 'da'), (2, 't'), (2, 'a'), + self.assertEqual(data, [(1, 'da'), (2, 't'), (2, 'a'), (3, '1234567890'), (3, '1'), (4, '12345')]) - self.assertEquals(self.channel.extBuf, [[4, '6']]) - self.assertEquals(self.channel.remoteWindowLeft, 0) + self.assertEqual(self.channel.extBuf, [[4, '6']]) + self.assertEqual(self.channel.remoteWindowLeft, 0) def test_writeSequence(self): """ @@ -250,7 +250,7 @@ """ self.channel.addWindowBytes(20) self.channel.writeSequence(map(str, range(10))) - self.assertEquals(self.conn.data[self.channel], ['0123456789']) + self.assertEqual(self.conn.data[self.channel], ['0123456789']) def test_loseConnection(self): """ @@ -260,9 +260,9 @@ self.channel.write('data') self.channel.writeExtended(1, 'datadata') self.channel.loseConnection() - self.assertEquals(self.conn.closes.get(self.channel), None) + self.assertEqual(self.conn.closes.get(self.channel), None) self.channel.addWindowBytes(4) # send regular data - self.assertEquals(self.conn.closes.get(self.channel), None) + self.assertEqual(self.conn.closes.get(self.channel), None) self.channel.addWindowBytes(8) # send extended data self.assertTrue(self.conn.closes.get(self.channel)) @@ -270,10 +270,10 @@ """ Test that getPeer() returns ('SSH', ). """ - self.assertEquals(self.channel.getPeer(), ('SSH', 'MockPeer')) + self.assertEqual(self.channel.getPeer(), ('SSH', 'MockPeer')) def test_getHost(self): """ Test that getHost() returns ('SSH', ). """ - self.assertEquals(self.channel.getHost(), ('SSH', 'MockHost')) + self.assertEqual(self.channel.getHost(), ('SSH', 'MockHost')) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_checkers.py twisted-conch-11.1.0/twisted/conch/test/test_checkers.py --- twisted-conch-11.0.0/twisted/conch/test/test_checkers.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_checkers.py 2011-07-14 19:05:14.000000000 +0000 @@ -81,8 +81,8 @@ authorized_keys file and check the keys against that file. """ self._testCheckKey("authorized_keys") - self.assertEquals(self.mockos.seteuidCalls, []) - self.assertEquals(self.mockos.setegidCalls, []) + self.assertEqual(self.mockos.seteuidCalls, []) + self.assertEqual(self.mockos.setegidCalls, []) def test_checkKey2(self): @@ -91,8 +91,8 @@ authorized_keys2 file and check the keys against that file. """ self._testCheckKey("authorized_keys2") - self.assertEquals(self.mockos.seteuidCalls, []) - self.assertEquals(self.mockos.setegidCalls, []) + self.assertEqual(self.mockos.seteuidCalls, []) + self.assertEqual(self.mockos.setegidCalls, []) def test_checkKeyAsRoot(self): @@ -114,8 +114,8 @@ user = UsernamePassword("user", "password") user.blob = "foobar" self.assertTrue(self.checker.checkKey(user)) - self.assertEquals(self.mockos.seteuidCalls, [0, 1, 0, os.getuid()]) - self.assertEquals(self.mockos.setegidCalls, [2, os.getgid()]) + self.assertEqual(self.mockos.seteuidCalls, [0, 1, 0, os.getuid()]) + self.assertEqual(self.mockos.setegidCalls, [2, os.getgid()]) def test_requestAvatarId(self): @@ -130,7 +130,7 @@ 'foo', keys.Key.fromString(keydata.privateRSA_openssh).sign('foo')) d = self.checker.requestAvatarId(credentials) def _verify(avatarId): - self.assertEquals(avatarId, 'test') + self.assertEqual(avatarId, 'test') return d.addCallback(_verify) @@ -208,9 +208,9 @@ the list of registered checkers. """ checker = SSHProtocolChecker() - self.assertEquals(checker.credentialInterfaces, []) + self.assertEqual(checker.credentialInterfaces, []) checker.registerChecker(SSHPublicKeyDatabase(), ) - self.assertEquals(checker.credentialInterfaces, [ISSHPrivateKey]) + self.assertEqual(checker.credentialInterfaces, [ISSHPrivateKey]) self.assertIsInstance(checker.checkers[ISSHPrivateKey], SSHPublicKeyDatabase) @@ -223,9 +223,9 @@ credentialIntefaces. """ checker = SSHProtocolChecker() - self.assertEquals(checker.credentialInterfaces, []) + self.assertEqual(checker.credentialInterfaces, []) checker.registerChecker(SSHPublicKeyDatabase(), IUsernamePassword) - self.assertEquals(checker.credentialInterfaces, [IUsernamePassword]) + self.assertEqual(checker.credentialInterfaces, [IUsernamePassword]) self.assertIsInstance(checker.checkers[IUsernamePassword], SSHPublicKeyDatabase) @@ -241,7 +241,7 @@ checker.registerChecker(passwordDatabase) d = checker.requestAvatarId(UsernamePassword('test', 'test')) def _callback(avatarId): - self.assertEquals(avatarId, 'test') + self.assertEqual(avatarId, 'test') return d.addCallback(_callback) @@ -277,4 +277,4 @@ """ The default L{SSHProcotolChecker.areDone} should simply return True. """ - self.assertEquals(SSHProtocolChecker().areDone(None), True) + self.assertEqual(SSHProtocolChecker().areDone(None), True) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_conch.py twisted-conch-11.1.0/twisted/conch/test/test_conch.py --- twisted-conch-11.0.0/twisted/conch/test/test_conch.py 2011-03-17 02:48:46.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_conch.py 2011-07-14 19:05:14.000000000 +0000 @@ -349,7 +349,7 @@ server. """ d = self.execute('echo goodbye', ConchTestOpenSSHProcess()) - return d.addCallback(self.assertEquals, 'goodbye\n') + return d.addCallback(self.assertEqual, 'goodbye\n') def test_localToRemoteForwarding(self): @@ -462,7 +462,7 @@ process = ConchTestOpenSSHProcess() d = self.execute("", process, '-o RekeyLimit=2K') def finished(result): - self.assertEquals( + self.assertEqual( result, '\n'.join(['line #%02d' % (i,) for i in range(60)]) + '\n') d.addCallback(finished) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_connection.py twisted-conch-11.1.0/twisted/conch/test/test_connection.py --- twisted-conch-11.0.0/twisted/conch/test/test_connection.py 2010-06-26 18:40:59.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_connection.py 2011-07-14 19:05:14.000000000 +0000 @@ -235,20 +235,20 @@ messages. """ self.conn.ssh_GLOBAL_REQUEST(common.NS('TestGlobal') + '\xff') - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_REQUEST_SUCCESS, '')]) self.transport.packets = [] self.conn.ssh_GLOBAL_REQUEST(common.NS('TestData') + '\xff' + 'test data') - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_REQUEST_SUCCESS, 'test data')]) self.transport.packets = [] self.conn.ssh_GLOBAL_REQUEST(common.NS('TestBad') + '\xff') - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_REQUEST_FAILURE, '')]) self.transport.packets = [] self.conn.ssh_GLOBAL_REQUEST(common.NS('TestGlobal') + '\x00') - self.assertEquals(self.transport.packets, []) + self.assertEqual(self.transport.packets, []) def test_REQUEST_SUCCESS(self): """ @@ -258,7 +258,7 @@ d = self.conn.sendGlobalRequest('request', 'data', True) self.conn.ssh_REQUEST_SUCCESS('data') def check(data): - self.assertEquals(data, 'data') + self.assertEqual(data, 'data') d.addCallback(check) d.addErrback(self.fail) return d @@ -271,7 +271,7 @@ d = self.conn.sendGlobalRequest('request', 'data', True) self.conn.ssh_REQUEST_FAILURE('data') def check(f): - self.assertEquals(f.value.data, 'data') + self.assertEqual(f.value.data, 'data') d.addCallback(self.fail) d.addErrback(check) return d @@ -285,12 +285,12 @@ self.conn.ssh_CHANNEL_OPEN(common.NS('TestChannel') + '\x00\x00\x00\x01' * 4) self.assertTrue(self.conn.channel.gotOpen) - self.assertEquals(self.conn.channel.conn, self.conn) - self.assertEquals(self.conn.channel.data, '\x00\x00\x00\x01') - self.assertEquals(self.conn.channel.specificData, '\x00\x00\x00\x01') - self.assertEquals(self.conn.channel.remoteWindowLeft, 1) - self.assertEquals(self.conn.channel.remoteMaxPacket, 1) - self.assertEquals(self.transport.packets, + self.assertEqual(self.conn.channel.conn, self.conn) + self.assertEqual(self.conn.channel.data, '\x00\x00\x00\x01') + self.assertEqual(self.conn.channel.specificData, '\x00\x00\x00\x01') + self.assertEqual(self.conn.channel.remoteWindowLeft, 1) + self.assertEqual(self.conn.channel.remoteMaxPacket, 1) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_OPEN_CONFIRMATION, '\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00' '\x00\x00\x80\x00')]) @@ -298,7 +298,7 @@ self.conn.ssh_CHANNEL_OPEN(common.NS('BadChannel') + '\x00\x00\x00\x02' * 4) self.flushLoggedErrors() - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_OPEN_FAILURE, '\x00\x00\x00\x02\x00\x00\x00\x03' + common.NS( 'unknown channel') + common.NS(''))]) @@ -306,7 +306,7 @@ self.conn.ssh_CHANNEL_OPEN(common.NS('ErrorChannel') + '\x00\x00\x00\x02' * 4) self.flushLoggedErrors() - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_OPEN_FAILURE, '\x00\x00\x00\x02\x00\x00\x00\x02' + common.NS( 'unknown failure') + common.NS(''))]) @@ -322,10 +322,10 @@ self.conn.ssh_CHANNEL_OPEN( common.NS('conch-error-args') + '\x00\x00\x00\x01' * 4) errors = self.flushLoggedErrors(error.ConchError) - self.assertEquals( + self.assertEqual( len(errors), 1, "Expected one error, got: %r" % (errors,)) - self.assertEquals(errors[0].value.args, (123, "error args in wrong order")) - self.assertEquals( + self.assertEqual(errors[0].value.args, (123, "error args in wrong order")) + self.assertEqual( self.transport.packets, [(connection.MSG_CHANNEL_OPEN_FAILURE, # The response includes some bytes which identifying the @@ -365,12 +365,12 @@ channel = TestChannel() self.conn.openChannel(channel) self.conn.ssh_CHANNEL_OPEN_CONFIRMATION('\x00\x00\x00\x00'*5) - self.assertEquals(channel.remoteWindowLeft, 0) - self.assertEquals(channel.remoteMaxPacket, 0) - self.assertEquals(channel.specificData, '\x00\x00\x00\x00') - self.assertEquals(self.conn.channelsToRemoteChannel[channel], + self.assertEqual(channel.remoteWindowLeft, 0) + self.assertEqual(channel.remoteMaxPacket, 0) + self.assertEqual(channel.specificData, '\x00\x00\x00\x00') + self.assertEqual(self.conn.channelsToRemoteChannel[channel], 0) - self.assertEquals(self.conn.localToRemoteChannel[0], 0) + self.assertEqual(self.conn.localToRemoteChannel[0], 0) def test_CHANNEL_OPEN_FAILURE(self): """ @@ -381,8 +381,8 @@ self.conn.openChannel(channel) self.conn.ssh_CHANNEL_OPEN_FAILURE('\x00\x00\x00\x00\x00\x00\x00' '\x01' + common.NS('failure!')) - self.assertEquals(channel.openFailureReason.args, ('failure!', 1)) - self.assertEquals(self.conn.channels.get(channel), None) + self.assertEqual(channel.openFailureReason.args, ('failure!', 1)) + self.assertEqual(self.conn.channels.get(channel), None) def test_CHANNEL_WINDOW_ADJUST(self): @@ -395,7 +395,7 @@ oldWindowSize = channel.remoteWindowLeft self.conn.ssh_CHANNEL_WINDOW_ADJUST('\x00\x00\x00\x00\x00\x00\x00' '\x01') - self.assertEquals(channel.remoteWindowLeft, oldWindowSize + 1) + self.assertEqual(channel.remoteWindowLeft, oldWindowSize + 1) def test_CHANNEL_DATA(self): """ @@ -405,23 +405,23 @@ channel = TestChannel(localWindow=6, localMaxPacket=5) self._openChannel(channel) self.conn.ssh_CHANNEL_DATA('\x00\x00\x00\x00' + common.NS('data')) - self.assertEquals(channel.inBuffer, ['data']) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.inBuffer, ['data']) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_WINDOW_ADJUST, '\x00\x00\x00\xff' '\x00\x00\x00\x04')]) self.transport.packets = [] longData = 'a' * (channel.localWindowLeft + 1) self.conn.ssh_CHANNEL_DATA('\x00\x00\x00\x00' + common.NS(longData)) - self.assertEquals(channel.inBuffer, ['data']) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.inBuffer, ['data']) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_CLOSE, '\x00\x00\x00\xff')]) channel = TestChannel() self._openChannel(channel) bigData = 'a' * (channel.localMaxPacket + 1) self.transport.packets = [] self.conn.ssh_CHANNEL_DATA('\x00\x00\x00\x01' + common.NS(bigData)) - self.assertEquals(channel.inBuffer, []) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.inBuffer, []) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_CLOSE, '\x00\x00\x00\xff')]) def test_CHANNEL_EXTENDED_DATA(self): @@ -433,16 +433,16 @@ self._openChannel(channel) self.conn.ssh_CHANNEL_EXTENDED_DATA('\x00\x00\x00\x00\x00\x00\x00' '\x00' + common.NS('data')) - self.assertEquals(channel.extBuffer, [(0, 'data')]) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.extBuffer, [(0, 'data')]) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_WINDOW_ADJUST, '\x00\x00\x00\xff' '\x00\x00\x00\x04')]) self.transport.packets = [] longData = 'a' * (channel.localWindowLeft + 1) self.conn.ssh_CHANNEL_EXTENDED_DATA('\x00\x00\x00\x00\x00\x00\x00' '\x00' + common.NS(longData)) - self.assertEquals(channel.extBuffer, [(0, 'data')]) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.extBuffer, [(0, 'data')]) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_CLOSE, '\x00\x00\x00\xff')]) channel = TestChannel() self._openChannel(channel) @@ -450,8 +450,8 @@ self.transport.packets = [] self.conn.ssh_CHANNEL_EXTENDED_DATA('\x00\x00\x00\x01\x00\x00\x00' '\x00' + common.NS(bigData)) - self.assertEquals(channel.extBuffer, []) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.extBuffer, []) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_CLOSE, '\x00\x00\x00\xff')]) def test_CHANNEL_EOF(self): @@ -484,11 +484,11 @@ self._openChannel(channel) self.conn.ssh_CHANNEL_REQUEST('\x00\x00\x00\x00' + common.NS('test') + '\x00') - self.assertEquals(channel.numberRequests, 1) + self.assertEqual(channel.numberRequests, 1) d = self.conn.ssh_CHANNEL_REQUEST('\x00\x00\x00\x00' + common.NS( 'test') + '\xff' + 'data') def check(result): - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_SUCCESS, '\x00\x00\x00\xff')]) d.addCallback(check) return d @@ -502,7 +502,7 @@ d = self.conn.ssh_CHANNEL_REQUEST('\x00\x00\x00\x00' + common.NS( 'test') + '\xff') def check(result): - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_FAILURE, '\x00\x00\x00\xff' )]) d.addCallback(self.fail) @@ -532,7 +532,7 @@ d = self.conn.sendRequest(channel, 'test', '', True) self.conn.ssh_CHANNEL_FAILURE('\x00\x00\x00\x00') def check(result): - self.assertEquals(result.value.value, 'channel request failed') + self.assertEqual(result.value.value, 'channel request failed') d.addCallback(self.fail) d.addErrback(check) return d @@ -545,12 +545,12 @@ # must be added to prevent errbacking during teardown d.addErrback(lambda failure: None) self.conn.sendGlobalRequest('noReply', '', False) - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_GLOBAL_REQUEST, common.NS('wantReply') + '\xffdata'), (connection.MSG_GLOBAL_REQUEST, common.NS('noReply') + '\x00')]) - self.assertEquals(self.conn.deferreds, {'global':[d]}) + self.assertEqual(self.conn.deferreds, {'global':[d]}) def test_openChannel(self): """ @@ -558,11 +558,11 @@ """ channel = TestChannel() self.conn.openChannel(channel, 'aaaa') - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_OPEN, common.NS('TestChannel') + '\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x80\x00aaaa')]) - self.assertEquals(channel.id, 0) - self.assertEquals(self.conn.localChannelID, 1) + self.assertEqual(channel.id, 0) + self.assertEqual(self.conn.localChannelID, 1) def test_sendRequest(self): """ @@ -576,12 +576,12 @@ self.conn.sendRequest(channel, 'test2', '', False) channel.localClosed = True # emulate sending a close message self.conn.sendRequest(channel, 'test3', '', True) - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_REQUEST, '\x00\x00\x00\xff' + common.NS('test') + '\x01test'), (connection.MSG_CHANNEL_REQUEST, '\x00\x00\x00\xff' + common.NS('test2') + '\x00')]) - self.assertEquals(self.conn.deferreds[0], [d]) + self.assertEqual(self.conn.deferreds[0], [d]) def test_adjustWindow(self): """ @@ -592,11 +592,11 @@ self._openChannel(channel) channel.localWindowLeft = 0 self.conn.adjustWindow(channel, 1) - self.assertEquals(channel.localWindowLeft, 1) + self.assertEqual(channel.localWindowLeft, 1) channel.localClosed = True self.conn.adjustWindow(channel, 2) - self.assertEquals(channel.localWindowLeft, 1) - self.assertEquals(self.transport.packets, + self.assertEqual(channel.localWindowLeft, 1) + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_WINDOW_ADJUST, '\x00\x00\x00\xff' '\x00\x00\x00\x01')]) @@ -609,7 +609,7 @@ self.conn.sendData(channel, 'a') channel.localClosed = True self.conn.sendData(channel, 'b') - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_DATA, '\x00\x00\x00\xff' + common.NS('a'))]) @@ -622,7 +622,7 @@ self.conn.sendExtendedData(channel, 1, 'test') channel.localClosed = True self.conn.sendExtendedData(channel, 2, 'test2') - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_EXTENDED_DATA, '\x00\x00\x00\xff' + '\x00\x00\x00\x01' + common.NS('test'))]) @@ -633,11 +633,11 @@ channel = TestChannel() self._openChannel(channel) self.conn.sendEOF(channel) - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_EOF, '\x00\x00\x00\xff')]) channel.localClosed = True self.conn.sendEOF(channel) - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_EOF, '\x00\x00\x00\xff')]) def test_sendClose(self): @@ -648,10 +648,10 @@ self._openChannel(channel) self.conn.sendClose(channel) self.assertTrue(channel.localClosed) - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_CLOSE, '\x00\x00\x00\xff')]) self.conn.sendClose(channel) - self.assertEquals(self.transport.packets, + self.assertEqual(self.transport.packets, [(connection.MSG_CHANNEL_CLOSE, '\x00\x00\x00\xff')]) channel2 = TestChannel() @@ -667,9 +667,9 @@ test_CHANNEL_OPEN. """ channel = self.conn.getChannel('TestChannel', 50, 30, 'data') - self.assertEquals(channel.data, 'data') - self.assertEquals(channel.remoteWindowLeft, 50) - self.assertEquals(channel.remoteMaxPacket, 30) + self.assertEqual(channel.data, 'data') + self.assertEqual(channel.remoteWindowLeft, 50) + self.assertEqual(channel.remoteMaxPacket, 30) self.assertRaises(error.ConchError, self.conn.getChannel, 'BadChannel', 50, 30, 'data') @@ -679,7 +679,7 @@ """ del self.transport.avatar self.assertTrue(self.conn.gotGlobalRequest('TestGlobal', 'data')) - self.assertEquals(self.conn.gotGlobalRequest('Test-Data', 'data'), + self.assertEqual(self.conn.gotGlobalRequest('Test-Data', 'data'), (True, 'data')) self.assertFalse(self.conn.gotGlobalRequest('BadGlobal', 'data')) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_default.py twisted-conch-11.1.0/twisted/conch/test/test_default.py --- twisted-conch-11.0.0/twisted/conch/test/test_default.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_default.py 2011-07-14 19:05:14.000000000 +0000 @@ -52,7 +52,7 @@ client.keyAgent = agent cleartext = "Sign here" client.signData(self.rsaPublic, cleartext) - self.assertEquals( + self.assertEqual( transport.value(), "\x00\x00\x00\x8b\r\x00\x00\x00u" + self.rsaPublic.blob() + "\x00\x00\x00\t" + cleartext + @@ -69,9 +69,9 @@ agent = SSHAgentClient() agent.blobs = [self.rsaPublic.blob()] key = agent.getPublicKey() - self.assertEquals(key.isPublic(), True) - self.assertEquals(key, self.rsaPublic) - self.assertEquals(agent.getPublicKey(), None) + self.assertEqual(key.isPublic(), True) + self.assertEqual(key, self.rsaPublic) + self.assertEqual(agent.getPublicKey(), None) def test_getPublicKeyFromFile(self): @@ -84,8 +84,8 @@ options.identitys = [self.rsaFile.path] client = SSHUserAuthClient("user", options, None) key = client.getPublicKey() - self.assertEquals(key.isPublic(), True) - self.assertEquals(key, self.rsaPublic) + self.assertEqual(key.isPublic(), True) + self.assertEqual(key, self.rsaPublic) def test_getPublicKeyAgentFallback(self): @@ -99,8 +99,8 @@ client = SSHUserAuthClient("user", options, None) client.keyAgent = agent key = client.getPublicKey() - self.assertEquals(key.isPublic(), True) - self.assertEquals(key, self.rsaPublic) + self.assertEqual(key.isPublic(), True) + self.assertEqual(key, self.rsaPublic) def test_getPublicKeyBadKeyError(self): @@ -117,9 +117,9 @@ self.tmpdir.child('id_rsa.pub').setContent('not a key!') client = SSHUserAuthClient("user", options, None) key = client.getPublicKey() - self.assertEquals(key.isPublic(), True) - self.assertEquals(key, Key.fromString(keydata.publicDSA_openssh)) - self.assertEquals(client.usedFiles, [self.rsaFile.path, dsaFile.path]) + self.assertEqual(key.isPublic(), True) + self.assertEqual(key, Key.fromString(keydata.publicDSA_openssh)) + self.assertEqual(client.usedFiles, [self.rsaFile.path, dsaFile.path]) def test_getPrivateKey(self): @@ -136,8 +136,8 @@ client.getPublicKey() def _cbGetPrivateKey(key): - self.assertEquals(key.isPublic(), False) - self.assertEquals(key, rsaPrivate) + self.assertEqual(key.isPublic(), False) + self.assertEqual(key, rsaPrivate) return client.getPrivateKey().addCallback(_cbGetPrivateKey) @@ -158,14 +158,14 @@ client.getPublicKey() def _getPassword(prompt): - self.assertEquals(prompt, + self.assertEqual(prompt, "Enter passphrase for key '%s': " % ( self.rsaFile.path,)) return passphrase def _cbGetPrivateKey(key): - self.assertEquals(key.isPublic(), False) - self.assertEquals(key, rsaPrivate) + self.assertEqual(key.isPublic(), False) + self.assertEqual(key, rsaPrivate) self.patch(client, '_getPassword', _getPassword) return client.getPrivateKey().addCallback(_cbGetPrivateKey) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_filetransfer.py twisted-conch-11.1.0/twisted/conch/test/test_filetransfer.py --- twisted-conch-11.0.0/twisted/conch/test/test_filetransfer.py 2008-11-01 15:32:22.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_filetransfer.py 2011-09-09 17:48:29.000000000 +0000 @@ -147,8 +147,8 @@ def testServerVersion(self): - self.failUnlessEqual(self._serverVersion, 3) - self.failUnlessEqual(self._extData, {'conchTest' : 'ext data'}) + self.assertEqual(self._serverVersion, 3) + self.assertEqual(self._extData, {'conchTest' : 'ext data'}) def test_openedFileClosedWithConnection(self): @@ -173,7 +173,7 @@ self.clientTransport.loseConnection() self.serverTransport.clearBuffer() self.clientTransport.clearBuffer() - self.assertEquals(self.server.openFiles, {}) + self.assertEqual(self.server.openFiles, {}) self.assertIn(fd, closed) d.addCallback(_fileOpened) @@ -193,7 +193,7 @@ self.clientTransport.loseConnection() self.serverTransport.clearBuffer() self.clientTransport.clearBuffer() - self.assertEquals(self.server.openDirs, {}) + self.assertEqual(self.server.openDirs, {}) d.addCallback(_getFiles) return d @@ -205,7 +205,7 @@ self._emptyBuffers() def _fileOpened(openFile): - self.failUnlessEqual(openFile, filetransfer.ISFTPFile(openFile)) + self.assertEqual(openFile, filetransfer.ISFTPFile(openFile)) d = _readChunk(openFile) d.addCallback(_writeChunk, openFile) return d @@ -213,7 +213,7 @@ def _readChunk(openFile): d = openFile.readChunk(0, 20) self._emptyBuffers() - d.addCallback(self.failUnlessEqual, 'a'*10 + 'b'*10) + d.addCallback(self.assertEqual, 'a'*10 + 'b'*10) return d def _writeChunk(_, openFile): @@ -225,7 +225,7 @@ def _readChunk2(_, openFile): d = openFile.readChunk(0, 30) self._emptyBuffers() - d.addCallback(self.failUnlessEqual, 'a'*10 + 'b'*10 + 'c'*10) + d.addCallback(self.assertEqual, 'a'*10 + 'b'*10 + 'c'*10) return d d.addCallback(_fileOpened) @@ -269,7 +269,7 @@ def _getAttrs2(attrs1): d = self.client.getAttrs('testfile1') self._emptyBuffers() - d.addCallback(self.failUnlessEqual, attrs1) + d.addCallback(self.assertEqual, attrs1) return d return d.addCallback(_getAttrs) @@ -293,7 +293,7 @@ d = self.client.setAttrs('testfile1', attrs) self._emptyBuffers() d.addCallback(_getAttrs2) - d.addCallback(self.failUnlessEqual, attrs) + d.addCallback(self.assertEqual, attrs) return d def _getAttrs2(_): @@ -323,7 +323,7 @@ self._emptyBuffers() def check(ign): - self.assertEquals(savedAttributes, {"ext_foo": "bar"}) + self.assertEqual(savedAttributes, {"ext_foo": "bar"}) return d.addCallback(check) @@ -350,7 +350,7 @@ def _testRenamed(_, attrs): d = self.client.getAttrs("testRenamedFile") self._emptyBuffers() - d.addCallback(self.failUnlessEqual, attrs) + d.addCallback(self.assertEqual, attrs) return d.addCallback(_rename) def testDirectoryBad(self): @@ -368,7 +368,7 @@ return d # XXX not until version 4/5 - # self.failUnlessEqual(filetransfer.FILEXFER_TYPE_DIRECTORY&attrs['type'], + # self.assertEqual(filetransfer.FILEXFER_TYPE_DIRECTORY&attrs['type'], # filetransfer.FILEXFER_TYPE_DIRECTORY) def _removeDirectory(_): @@ -400,7 +400,7 @@ def _checkFiles(ignored): fs = list(zip(*files)[0]) fs.sort() - self.failUnlessEqual(fs, + self.assertEqual(fs, ['.testHiddenFile', 'testDirectory', 'testRemoveFile', 'testRenameFile', 'testfile1']) @@ -440,13 +440,13 @@ def _readLink(_): d = self.client.readLink('testLink') self._emptyBuffers() - d.addCallback(self.failUnlessEqual, + d.addCallback(self.assertEqual, os.path.join(os.getcwd(), self.testDir, 'testfile1')) return d def _realPath(_): d = self.client.realPath('testLink') self._emptyBuffers() - d.addCallback(self.failUnlessEqual, + d.addCallback(self.assertEqual, os.path.join(os.getcwd(), self.testDir, 'testfile1')) return d d.addCallback(_readLink) @@ -456,7 +456,7 @@ def testExtendedRequest(self): d = self.client.extendedRequest('testExtendedRequest', 'foo') self._emptyBuffers() - d.addCallback(self.failUnlessEqual, 'bar') + d.addCallback(self.assertEqual, 'bar') d.addCallback(self._cbTestExtendedRequest) return d @@ -675,3 +675,91 @@ len(constants) > 0, "No constants found (the test must be buggy).") for k, v in constants.items(): self.assertEqual(v, getattr(filetransfer, k)) + + + +class TestRawPacketData(unittest.TestCase): + """ + Tests for L{filetransfer.FileTransferClient} which explicitly craft certain + less common protocol messages to exercise their handling. + """ + def setUp(self): + self.ftc = filetransfer.FileTransferClient() + + + def test_packetSTATUS(self): + """ + A STATUS packet containing a result code, a message, and a language is + parsed to produce the result of an outstanding request L{Deferred}. + + @see: U{section 9.1} + of the SFTP Internet-Draft. + """ + d = defer.Deferred() + d.addCallback(self._cbTestPacketSTATUS) + self.ftc.openRequests[1] = d + data = struct.pack('!LL', 1, filetransfer.FX_OK) + common.NS('msg') + common.NS('lang') + self.ftc.packet_STATUS(data) + return d + + + def _cbTestPacketSTATUS(self, result): + """ + Assert that the result is a two-tuple containing the message and + language from the STATUS packet. + """ + self.assertEqual(result[0], 'msg') + self.assertEqual(result[1], 'lang') + + + def test_packetSTATUSShort(self): + """ + A STATUS packet containing only a result code can also be parsed to + produce the result of an outstanding request L{Deferred}. Such packets + are sent by some SFTP implementations, though not strictly legal. + + @see: U{section 9.1} + of the SFTP Internet-Draft. + """ + d = defer.Deferred() + d.addCallback(self._cbTestPacketSTATUSShort) + self.ftc.openRequests[1] = d + data = struct.pack('!LL', 1, filetransfer.FX_OK) + self.ftc.packet_STATUS(data) + return d + + + def _cbTestPacketSTATUSShort(self, result): + """ + Assert that the result is a two-tuple containing empty strings, since + the STATUS packet had neither a message nor a language. + """ + self.assertEqual(result[0], '') + self.assertEqual(result[1], '') + + + def test_packetSTATUSWithoutLang(self): + """ + A STATUS packet containing a result code and a message but no language + can also be parsed to produce the result of an outstanding request + L{Deferred}. Such packets are sent by some SFTP implementations, though + not strictly legal. + + @see: U{section 9.1} + of the SFTP Internet-Draft. + """ + d = defer.Deferred() + d.addCallback(self._cbTestPacketSTATUSWithoutLang) + self.ftc.openRequests[1] = d + data = struct.pack('!LL', 1, filetransfer.FX_OK) + common.NS('msg') + self.ftc.packet_STATUS(data) + return d + + + def _cbTestPacketSTATUSWithoutLang(self, result): + """ + Assert that the result is a two-tuple containing the message from the + STATUS packet and an empty string, since the language was missing. + """ + self.assertEqual(result[0], 'msg') + self.assertEqual(result[1], '') diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_helper.py twisted-conch-11.1.0/twisted/conch/test/test_helper.py --- twisted-conch-11.0.0/twisted/conch/test/test_helper.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_helper.py 2011-07-14 19:05:14.000000000 +0000 @@ -18,11 +18,11 @@ self.term.connectionMade() def testInitialState(self): - self.assertEquals(self.term.width, WIDTH) - self.assertEquals(self.term.height, HEIGHT) - self.assertEquals(str(self.term), + self.assertEqual(self.term.width, WIDTH) + self.assertEqual(self.term.height, HEIGHT) + self.assertEqual(str(self.term), '\n' * (HEIGHT - 1)) - self.assertEquals(self.term.reportCursorPosition(), (0, 0)) + self.assertEqual(self.term.reportCursorPosition(), (0, 0)) def test_initialPrivateModes(self): @@ -94,50 +94,50 @@ def testCursorDown(self): self.term.cursorDown(3) - self.assertEquals(self.term.reportCursorPosition(), (0, 3)) + self.assertEqual(self.term.reportCursorPosition(), (0, 3)) self.term.cursorDown() - self.assertEquals(self.term.reportCursorPosition(), (0, 4)) + self.assertEqual(self.term.reportCursorPosition(), (0, 4)) self.term.cursorDown(HEIGHT) - self.assertEquals(self.term.reportCursorPosition(), (0, HEIGHT - 1)) + self.assertEqual(self.term.reportCursorPosition(), (0, HEIGHT - 1)) def testCursorUp(self): self.term.cursorUp(5) - self.assertEquals(self.term.reportCursorPosition(), (0, 0)) + self.assertEqual(self.term.reportCursorPosition(), (0, 0)) self.term.cursorDown(20) self.term.cursorUp(1) - self.assertEquals(self.term.reportCursorPosition(), (0, 19)) + self.assertEqual(self.term.reportCursorPosition(), (0, 19)) self.term.cursorUp(19) - self.assertEquals(self.term.reportCursorPosition(), (0, 0)) + self.assertEqual(self.term.reportCursorPosition(), (0, 0)) def testCursorForward(self): self.term.cursorForward(2) - self.assertEquals(self.term.reportCursorPosition(), (2, 0)) + self.assertEqual(self.term.reportCursorPosition(), (2, 0)) self.term.cursorForward(2) - self.assertEquals(self.term.reportCursorPosition(), (4, 0)) + self.assertEqual(self.term.reportCursorPosition(), (4, 0)) self.term.cursorForward(WIDTH) - self.assertEquals(self.term.reportCursorPosition(), (WIDTH, 0)) + self.assertEqual(self.term.reportCursorPosition(), (WIDTH, 0)) def testCursorBackward(self): self.term.cursorForward(10) self.term.cursorBackward(2) - self.assertEquals(self.term.reportCursorPosition(), (8, 0)) + self.assertEqual(self.term.reportCursorPosition(), (8, 0)) self.term.cursorBackward(7) - self.assertEquals(self.term.reportCursorPosition(), (1, 0)) + self.assertEqual(self.term.reportCursorPosition(), (1, 0)) self.term.cursorBackward(1) - self.assertEquals(self.term.reportCursorPosition(), (0, 0)) + self.assertEqual(self.term.reportCursorPosition(), (0, 0)) self.term.cursorBackward(1) - self.assertEquals(self.term.reportCursorPosition(), (0, 0)) + self.assertEqual(self.term.reportCursorPosition(), (0, 0)) def testCursorPositioning(self): self.term.cursorPosition(3, 9) - self.assertEquals(self.term.reportCursorPosition(), (3, 9)) + self.assertEqual(self.term.reportCursorPosition(), (3, 9)) def testSimpleWriting(self): s = "Hello, world." self.term.write(s) - self.assertEquals( + self.assertEqual( str(self.term), s + '\n' + '\n' * (HEIGHT - 2)) @@ -148,7 +148,7 @@ self.term.cursorBackward(len(s)) self.term.resetModes([modes.IRM]) self.term.write("H") - self.assertEquals( + self.assertEqual( str(self.term), ("H" + s[1:]) + '\n' + '\n' * (HEIGHT - 2)) @@ -159,7 +159,7 @@ self.term.cursorBackward(len(s)) self.term.setModes([modes.IRM]) self.term.write("H") - self.assertEquals( + self.assertEqual( str(self.term), ("H" + s) + '\n' + '\n' * (HEIGHT - 2)) @@ -169,7 +169,7 @@ self.term.cursorDown(5) self.term.cursorForward(5) self.term.write(s) - self.assertEquals( + self.assertEqual( str(self.term), '\n' * 5 + (self.term.fill * 5) + s + '\n' + @@ -179,7 +179,7 @@ s = "Hello, world." self.term.cursorForward(WIDTH - 5) self.term.write(s) - self.assertEquals( + self.assertEqual( str(self.term), s[:5].rjust(WIDTH) + '\n' + s[5:] + '\n' + @@ -187,19 +187,19 @@ def testIndex(self): self.term.index() - self.assertEquals(self.term.reportCursorPosition(), (0, 1)) + self.assertEqual(self.term.reportCursorPosition(), (0, 1)) self.term.cursorDown(HEIGHT) - self.assertEquals(self.term.reportCursorPosition(), (0, HEIGHT - 1)) + self.assertEqual(self.term.reportCursorPosition(), (0, HEIGHT - 1)) self.term.index() - self.assertEquals(self.term.reportCursorPosition(), (0, HEIGHT - 1)) + self.assertEqual(self.term.reportCursorPosition(), (0, HEIGHT - 1)) def testReverseIndex(self): self.term.reverseIndex() - self.assertEquals(self.term.reportCursorPosition(), (0, 0)) + self.assertEqual(self.term.reportCursorPosition(), (0, 0)) self.term.cursorDown(2) - self.assertEquals(self.term.reportCursorPosition(), (0, 2)) + self.assertEqual(self.term.reportCursorPosition(), (0, 2)) self.term.reverseIndex() - self.assertEquals(self.term.reportCursorPosition(), (0, 1)) + self.assertEqual(self.term.reportCursorPosition(), (0, 1)) def test_nextLine(self): """ @@ -207,45 +207,45 @@ current row. """ self.term.nextLine() - self.assertEquals(self.term.reportCursorPosition(), (0, 1)) + self.assertEqual(self.term.reportCursorPosition(), (0, 1)) self.term.cursorForward(5) - self.assertEquals(self.term.reportCursorPosition(), (5, 1)) + self.assertEqual(self.term.reportCursorPosition(), (5, 1)) self.term.nextLine() - self.assertEquals(self.term.reportCursorPosition(), (0, 2)) + self.assertEqual(self.term.reportCursorPosition(), (0, 2)) def testSaveCursor(self): self.term.cursorDown(5) self.term.cursorForward(7) - self.assertEquals(self.term.reportCursorPosition(), (7, 5)) + self.assertEqual(self.term.reportCursorPosition(), (7, 5)) self.term.saveCursor() self.term.cursorDown(7) self.term.cursorBackward(3) - self.assertEquals(self.term.reportCursorPosition(), (4, 12)) + self.assertEqual(self.term.reportCursorPosition(), (4, 12)) self.term.restoreCursor() - self.assertEquals(self.term.reportCursorPosition(), (7, 5)) + self.assertEqual(self.term.reportCursorPosition(), (7, 5)) def testSingleShifts(self): self.term.singleShift2() self.term.write('Hi') ch = self.term.getCharacter(0, 0) - self.assertEquals(ch[0], 'H') - self.assertEquals(ch[1].charset, G2) + self.assertEqual(ch[0], 'H') + self.assertEqual(ch[1].charset, G2) ch = self.term.getCharacter(1, 0) - self.assertEquals(ch[0], 'i') - self.assertEquals(ch[1].charset, G0) + self.assertEqual(ch[0], 'i') + self.assertEqual(ch[1].charset, G0) self.term.singleShift3() self.term.write('!!') ch = self.term.getCharacter(2, 0) - self.assertEquals(ch[0], '!') - self.assertEquals(ch[1].charset, G3) + self.assertEqual(ch[0], '!') + self.assertEqual(ch[1].charset, G3) ch = self.term.getCharacter(3, 0) - self.assertEquals(ch[0], '!') - self.assertEquals(ch[1].charset, G0) + self.assertEqual(ch[0], '!') + self.assertEqual(ch[1].charset, G0) def testShifting(self): s1 = "Hello" @@ -262,8 +262,8 @@ for s in (s1, s2, s3): for i in range(len(s)): ch = self.term.getCharacter(i, h) - self.assertEquals(ch[0], s[i]) - self.assertEquals(ch[1].charset, g) + self.assertEqual(ch[0], s[i]) + self.assertEqual(ch[1].charset, g) g = g == G0 and G1 or G0 h += 1 @@ -278,28 +278,28 @@ self.term.write('Z') ch = self.term.getCharacter(0, 0) - self.assertEquals(ch[0], 'W') + self.assertEqual(ch[0], 'W') self.failUnless(ch[1].bold) self.failUnless(ch[1].underline) self.failUnless(ch[1].blink) self.failUnless(ch[1].reverseVideo) ch = self.term.getCharacter(1, 0) - self.assertEquals(ch[0], 'X') + self.assertEqual(ch[0], 'X') self.failIf(ch[1].bold) self.failIf(ch[1].underline) self.failIf(ch[1].blink) self.failIf(ch[1].reverseVideo) ch = self.term.getCharacter(2, 0) - self.assertEquals(ch[0], 'Y') + self.assertEqual(ch[0], 'Y') self.failUnless(ch[1].blink) self.failIf(ch[1].bold) self.failIf(ch[1].underline) self.failIf(ch[1].reverseVideo) ch = self.term.getCharacter(3, 0) - self.assertEquals(ch[0], 'Z') + self.assertEqual(ch[0], 'Z') self.failUnless(ch[1].blink) self.failUnless(ch[1].bold) self.failIf(ch[1].underline) @@ -316,25 +316,25 @@ for i in range(len(s1)): ch = self.term.getCharacter(i, 0) - self.assertEquals(ch[0], s1[i]) - self.assertEquals(ch[1].charset, G0) - self.assertEquals(ch[1].bold, False) - self.assertEquals(ch[1].underline, False) - self.assertEquals(ch[1].blink, False) - self.assertEquals(ch[1].reverseVideo, False) - self.assertEquals(ch[1].foreground, helper.RED) - self.assertEquals(ch[1].background, helper.GREEN) + self.assertEqual(ch[0], s1[i]) + self.assertEqual(ch[1].charset, G0) + self.assertEqual(ch[1].bold, False) + self.assertEqual(ch[1].underline, False) + self.assertEqual(ch[1].blink, False) + self.assertEqual(ch[1].reverseVideo, False) + self.assertEqual(ch[1].foreground, helper.RED) + self.assertEqual(ch[1].background, helper.GREEN) for i in range(len(s2)): ch = self.term.getCharacter(i, 1) - self.assertEquals(ch[0], s2[i]) - self.assertEquals(ch[1].charset, G0) - self.assertEquals(ch[1].bold, False) - self.assertEquals(ch[1].underline, False) - self.assertEquals(ch[1].blink, False) - self.assertEquals(ch[1].reverseVideo, False) - self.assertEquals(ch[1].foreground, helper.WHITE) - self.assertEquals(ch[1].background, helper.BLACK) + self.assertEqual(ch[0], s2[i]) + self.assertEqual(ch[1].charset, G0) + self.assertEqual(ch[1].bold, False) + self.assertEqual(ch[1].underline, False) + self.assertEqual(ch[1].blink, False) + self.assertEqual(ch[1].reverseVideo, False) + self.assertEqual(ch[1].foreground, helper.WHITE) + self.assertEqual(ch[1].background, helper.BLACK) def testEraseLine(self): s1 = 'line 1' @@ -344,7 +344,7 @@ self.term.cursorPosition(1, 1) self.term.eraseLine() - self.assertEquals( + self.assertEqual( str(self.term), s1 + '\n' + '\n' + @@ -356,7 +356,7 @@ self.term.write(s) self.term.cursorBackward(5) self.term.eraseToLineEnd() - self.assertEquals( + self.assertEqual( str(self.term), s[:-5] + '\n' + '\n' * (HEIGHT - 2)) @@ -366,7 +366,7 @@ self.term.write(s) self.term.cursorBackward(5) self.term.eraseToLineBeginning() - self.assertEquals( + self.assertEqual( str(self.term), s[-4:].rjust(len(s)) + '\n' + '\n' * (HEIGHT - 2)) @@ -376,7 +376,7 @@ self.term.write('Goodbye world\n') self.term.eraseDisplay() - self.assertEquals( + self.assertEqual( str(self.term), '\n' * (HEIGHT - 1)) @@ -387,7 +387,7 @@ self.term.cursorPosition(5, 1) self.term.eraseToDisplayEnd() - self.assertEquals( + self.assertEqual( str(self.term), s1 + '\n' + s2[:5] + '\n' + @@ -400,7 +400,7 @@ self.term.cursorPosition(5, 1) self.term.eraseToDisplayBeginning() - self.assertEquals( + self.assertEqual( str(self.term), '\n' + s2[6:].rjust(len(s2)) + '\n' + @@ -413,7 +413,7 @@ self.term.cursorPosition(7, 1) self.term.insertLine() - self.assertEquals( + self.assertEqual( str(self.term), s1 + '\n' + '\n' + @@ -428,7 +428,7 @@ self.term.cursorPosition(9, 1) self.term.deleteLine() - self.assertEquals( + self.assertEqual( str(self.term), s1 + '\n' + s3 + '\n' + @@ -478,8 +478,8 @@ self.failIf(result) self.term.write("hello world\n") self.failUnless(result) - self.assertEquals(result[0].group(), "hello world") - self.assertEquals(len(self.fs.calls), 1) + self.assertEqual(result[0].group(), "hello world") + self.assertEqual(len(self.fs.calls), 1) self.failIf(self.fs.calls[0].active()) def testBrokenUpString(self): @@ -494,7 +494,7 @@ self.failIf(result) self.term.write("d") self.failUnless(result) - self.assertEquals(result[0].group(), "hello world") + self.assertEqual(result[0].group(), "hello world") def testMultiple(self): @@ -508,11 +508,11 @@ self.term.write("hello") self.failIf(result) self.term.write(" ") - self.assertEquals(len(result), 1) + self.assertEqual(len(result), 1) self.term.write("world") - self.assertEquals(len(result), 2) - self.assertEquals(result[0].group(), "hello ") - self.assertEquals(result[1].group(), "world") + self.assertEqual(len(result), 2) + self.assertEqual(result[0].group(), "hello ") + self.assertEqual(result[1].group(), "world") def testSynchronous(self): self.term.write("hello world") @@ -521,7 +521,7 @@ d = self.term.expect("hello world") d.addCallback(result.append) self.failUnless(result) - self.assertEquals(result[0].group(), "hello world") + self.assertEqual(result[0].group(), "hello world") def testMultipleSynchronous(self): self.term.write("goodbye world") @@ -532,9 +532,9 @@ d2 = self.term.expect("world") d2.addCallback(result.append) - self.assertEquals(len(result), 2) - self.assertEquals(result[0].group(), "bye") - self.assertEquals(result[1].group(), "world") + self.assertEqual(len(result), 2) + self.assertEqual(result[0].group(), "bye") + self.assertEqual(result[1].group(), "world") def _cbTestTimeoutFailure(self, res): self.assert_(hasattr(res, 'type')) @@ -556,5 +556,5 @@ self.fs.calls[0].call() - self.assertEquals(len(result), 1) - self.assertEquals(result[0].group(), "zoom") + self.assertEqual(len(result), 1) + self.assertEqual(result[0].group(), "zoom") diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_insults.py twisted-conch-11.1.0/twisted/conch/test/test_insults.py --- twisted-conch-11.0.0/twisted/conch/test/test_insults.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_insults.py 2011-07-14 19:05:14.000000000 +0000 @@ -61,12 +61,12 @@ def assertCall(self, occurrence, methodName, expectedPositionalArgs=(), expectedKeywordArgs={}): attr, mock = occurrence - self.assertEquals(attr, methodName) - self.assertEquals(len(occurrences(mock)), 1) + self.assertEqual(attr, methodName) + self.assertEqual(len(occurrences(mock)), 1) [(call, result, args, kw)] = occurrences(mock) - self.assertEquals(call, "__call__") - self.assertEquals(args, expectedPositionalArgs) - self.assertEquals(kw, expectedKeywordArgs) + self.assertEqual(call, "__call__") + self.assertEqual(args, expectedPositionalArgs) + self.assertEqual(kw, expectedKeywordArgs) return result @@ -95,7 +95,7 @@ def verifyResults(self, transport, proto, parser): result = self.assertCall(occurrences(proto).pop(0), "makeConnection", (parser,)) - self.assertEquals(occurrences(result), []) + self.assertEqual(occurrences(result), []) del _byteGroupingTestTemplate @@ -111,7 +111,7 @@ for arrow in (parser.UP_ARROW, parser.DOWN_ARROW, parser.RIGHT_ARROW, parser.LEFT_ARROW): result = self.assertCall(occurrences(proto).pop(0), "keystrokeReceived", (arrow, None)) - self.assertEquals(occurrences(result), []) + self.assertEqual(occurrences(result), []) self.failIf(occurrences(proto)) @@ -128,11 +128,11 @@ for char in 'abc123ABC!@#': result = self.assertCall(occurrences(proto).pop(0), "keystrokeReceived", (char, None)) - self.assertEquals(occurrences(result), []) + self.assertEqual(occurrences(result), []) for char in 'abc123': result = self.assertCall(occurrences(proto).pop(0), "keystrokeReceived", (char, parser.ALT)) - self.assertEquals(occurrences(result), []) + self.assertEqual(occurrences(result), []) occs = occurrences(proto) self.failIf(occs, "%r should have been []" % (occs,)) @@ -155,7 +155,7 @@ for funcNum in range(1, 13): funcArg = getattr(parser, 'F%d' % (funcNum,)) result = self.assertCall(occurrences(proto).pop(0), "keystrokeReceived", (funcArg, None)) - self.assertEquals(occurrences(result), []) + self.assertEqual(occurrences(result), []) self.failIf(occurrences(proto)) class ClientCursorMovement(ByteGroupingsMixin, unittest.TestCase): @@ -175,7 +175,7 @@ for (method, count) in [('Down', 2), ('Forward', 4), ('Up', 1), ('Backward', 2), ('Up', 1), ('Backward', 2)]: result = self.assertCall(occurrences(proto).pop(0), "cursor" + method, (count,)) - self.assertEquals(occurrences(result), []) + self.assertEqual(occurrences(result), []) self.failIf(occurrences(proto)) class ClientControlSequences(unittest.TestCase, MockMixin): @@ -354,13 +354,13 @@ def testCursorPosition(self): methods(self.proto)['reportCursorPosition'] = (6, 7) self.parser.dataReceived("\x1b[6n") - self.assertEquals(self.transport.value(), "\x1b[7;8R") + self.assertEqual(self.transport.value(), "\x1b[7;8R") occs = occurrences(self.proto) result = self.assertCall(occs.pop(0), "reportCursorPosition") # This isn't really an interesting assert, since it only tests that # our mock setup is working right, but I'll include it anyway. - self.assertEquals(result, (6, 7)) + self.assertEqual(result, (6, 7)) def test_applicationDataBytes(self): @@ -472,8 +472,8 @@ """ warnings = self.flushWarnings() self.assertIdentical(warnings[0]['category'], DeprecationWarning) - self.assertEquals(warnings[0]['message'], message) - self.assertEquals(len(warnings), 1) + self.assertEqual(warnings[0]['message'], message) + self.assertEqual(len(warnings), 1) def test_colors(self): diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_keys.py twisted-conch-11.1.0/twisted/conch/test/test_keys.py --- twisted-conch-11.0.0/twisted/conch/test/test_keys.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_keys.py 2011-07-14 19:05:14.000000000 +0000 @@ -47,11 +47,11 @@ """ data = 'ABC' messageSize = 6 - self.assertEquals(keys.pkcs1Pad(data, messageSize), + self.assertEqual(keys.pkcs1Pad(data, messageSize), '\x01\xff\x00ABC') hash = sha1().digest() messageSize = 40 - self.assertEquals(keys.pkcs1Digest('', messageSize), + self.assertEqual(keys.pkcs1Digest('', messageSize), '\x01\xff\xff\xff\x00' + keys.ID_SHA1 + hash) def _signRSA(self, data): @@ -72,7 +72,7 @@ key, sig = self._signRSA(data) sigData = keys.pkcs1Digest(data, keys.lenSig(key)) v = key.sign(sigData, '')[0] - self.assertEquals(sig, common.NS('ssh-rsa') + common.MP(v)) + self.assertEqual(sig, common.NS('ssh-rsa') + common.MP(v)) return key, sig def test_signDSA(self): @@ -83,7 +83,7 @@ key, sig = self._signDSA(data) sigData = sha1(data).digest() v = key.sign(sigData, '\x55' * 19) - self.assertEquals(sig, common.NS('ssh-dss') + common.NS( + self.assertEqual(sig, common.NS('ssh-dss') + common.NS( Crypto.Util.number.long_to_bytes(v[0], 20) + Crypto.Util.number.long_to_bytes(v[1], 20))) return key, sig @@ -93,9 +93,9 @@ """ Test that objectType, returns the correct type for objects. """ - self.assertEquals(keys.objectType(keys.Key.fromString( + self.assertEqual(keys.objectType(keys.Key.fromString( keydata.privateRSA_openssh).keyObject), 'ssh-rsa') - self.assertEquals(keys.objectType(keys.Key.fromString( + self.assertEqual(keys.objectType(keys.Key.fromString( keydata.privateDSA_openssh).keyObject), 'ssh-dss') self.assertRaises(keys.BadKeyError, keys.objectType, None) @@ -136,33 +136,33 @@ Test that the _guessStringType method guesses string types correctly. """ - self.assertEquals(keys.Key._guessStringType(keydata.publicRSA_openssh), + self.assertEqual(keys.Key._guessStringType(keydata.publicRSA_openssh), 'public_openssh') - self.assertEquals(keys.Key._guessStringType(keydata.publicDSA_openssh), + self.assertEqual(keys.Key._guessStringType(keydata.publicDSA_openssh), 'public_openssh') - self.assertEquals(keys.Key._guessStringType( + self.assertEqual(keys.Key._guessStringType( keydata.privateRSA_openssh), 'private_openssh') - self.assertEquals(keys.Key._guessStringType( + self.assertEqual(keys.Key._guessStringType( keydata.privateDSA_openssh), 'private_openssh') - self.assertEquals(keys.Key._guessStringType(keydata.publicRSA_lsh), + self.assertEqual(keys.Key._guessStringType(keydata.publicRSA_lsh), 'public_lsh') - self.assertEquals(keys.Key._guessStringType(keydata.publicDSA_lsh), + self.assertEqual(keys.Key._guessStringType(keydata.publicDSA_lsh), 'public_lsh') - self.assertEquals(keys.Key._guessStringType(keydata.privateRSA_lsh), + self.assertEqual(keys.Key._guessStringType(keydata.privateRSA_lsh), 'private_lsh') - self.assertEquals(keys.Key._guessStringType(keydata.privateDSA_lsh), + self.assertEqual(keys.Key._guessStringType(keydata.privateDSA_lsh), 'private_lsh') - self.assertEquals(keys.Key._guessStringType( + self.assertEqual(keys.Key._guessStringType( keydata.privateRSA_agentv3), 'agentv3') - self.assertEquals(keys.Key._guessStringType( + self.assertEqual(keys.Key._guessStringType( keydata.privateDSA_agentv3), 'agentv3') - self.assertEquals(keys.Key._guessStringType( + self.assertEqual(keys.Key._guessStringType( '\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01\x01'), 'blob') - self.assertEquals(keys.Key._guessStringType( + self.assertEqual(keys.Key._guessStringType( '\x00\x00\x00\x07ssh-dss\x00\x00\x00\x01\x01'), 'blob') - self.assertEquals(keys.Key._guessStringType('not a key'), + self.assertEqual(keys.Key._guessStringType('not a key'), None) def _testPublicPrivateFromString(self, public, private, type, data): @@ -172,16 +172,16 @@ def _testPublicFromString(self, public, type, data): publicKey = keys.Key.fromString(public) self.assertTrue(publicKey.isPublic()) - self.assertEquals(publicKey.type(), type) + self.assertEqual(publicKey.type(), type) for k, v in publicKey.data().items(): - self.assertEquals(data[k], v) + self.assertEqual(data[k], v) def _testPrivateFromString(self, private, type, data): privateKey = keys.Key.fromString(private) self.assertFalse(privateKey.isPublic()) - self.assertEquals(privateKey.type(), type) + self.assertEqual(privateKey.type(), type) for k, v in data.items(): - self.assertEquals(privateKey.data()[k], v) + self.assertEqual(privateKey.data()[k], v) def test_fromOpenSSH(self): """ @@ -189,11 +189,11 @@ """ self._testPublicPrivateFromString(keydata.publicRSA_openssh, keydata.privateRSA_openssh, 'RSA', keydata.RSAData) - self.assertEquals(keys.Key.fromString( + self.assertEqual(keys.Key.fromString( keydata.privateRSA_openssh_encrypted, passphrase='encrypted'), keys.Key.fromString(keydata.privateRSA_openssh)) - self.assertEquals(keys.Key.fromString( + self.assertEqual(keys.Key.fromString( keydata.privateRSA_openssh_alternate), keys.Key.fromString(keydata.privateRSA_openssh)) self._testPublicPrivateFromString(keydata.publicDSA_openssh, @@ -217,7 +217,7 @@ /ow0IqSj0VF72VJN9uSoPpFd4lLT0zN8v42RWja0M8ohWNf+YNJluPgCFE0PT4Vm SUrCyZXsNh6VXwjs3gKQ -----END DSA PRIVATE KEY-----""" - self.assertEquals(keys.Key.fromString(privateDSAData), + self.assertEqual(keys.Key.fromString(privateDSAData), keys.Key.fromString(privateDSAData + '\n')) def test_fromLSH(self): @@ -268,7 +268,7 @@ """ Test that fromFile works correctly. """ - self.assertEquals(keys.Key.fromFile(self.keyFile), + self.assertEqual(keys.Key.fromFile(self.keyFile), keys.Key.fromString(keydata.privateRSA_lsh)) self.assertRaises(keys.BadKeyError, keys.Key.fromFile, self.keyFile, 'bad_type') @@ -281,7 +281,7 @@ """ obj = Crypto.PublicKey.RSA.construct((1L, 2L)) key = keys.Key(obj) - self.assertEquals(key.keyObject, obj) + self.assertEqual(key.keyObject, obj) def test_equal(self): """ @@ -315,10 +315,10 @@ """ Test that the type method returns the correct type for an object. """ - self.assertEquals(keys.Key(self.rsaObj).type(), 'RSA') - self.assertEquals(keys.Key(self.rsaObj).sshType(), 'ssh-rsa') - self.assertEquals(keys.Key(self.dsaObj).type(), 'DSA') - self.assertEquals(keys.Key(self.dsaObj).sshType(), 'ssh-dss') + self.assertEqual(keys.Key(self.rsaObj).type(), 'RSA') + self.assertEqual(keys.Key(self.rsaObj).sshType(), 'ssh-rsa') + self.assertEqual(keys.Key(self.dsaObj).type(), 'DSA') + self.assertEqual(keys.Key(self.dsaObj).sshType(), 'ssh-dss') self.assertRaises(RuntimeError, keys.Key(None).type) self.assertRaises(RuntimeError, keys.Key(None).sshType) self.assertRaises(RuntimeError, keys.Key(self).type) @@ -335,9 +335,9 @@ dsaKey = keys.Key.fromString(dsaBlob) badBlob = common.NS('ssh-bad') self.assertTrue(rsaKey.isPublic()) - self.assertEquals(rsaKey.data(), {'e':2L, 'n':3L}) + self.assertEqual(rsaKey.data(), {'e':2L, 'n':3L}) self.assertTrue(dsaKey.isPublic()) - self.assertEquals(dsaKey.data(), {'p':2L, 'q':3L, 'g':4L, 'y':5L}) + self.assertEqual(dsaKey.data(), {'p':2L, 'q':3L, 'g':4L, 'y':5L}) self.assertRaises(keys.BadKeyError, keys.Key.fromString, badBlob) @@ -366,10 +366,10 @@ """ Test that the Key object generates blobs correctly. """ - self.assertEquals(keys.Key(self.rsaObj).blob(), + self.assertEqual(keys.Key(self.rsaObj).blob(), '\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01\x02' '\x00\x00\x00\x01\x01') - self.assertEquals(keys.Key(self.dsaObj).blob(), + self.assertEqual(keys.Key(self.dsaObj).blob(), '\x00\x00\x00\x07ssh-dss\x00\x00\x00\x01\x03' '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x02' '\x00\x00\x00\x01\x01') @@ -383,12 +383,12 @@ L{Key.privateBlob} returns the SSH protocol-level format of the private key and raises L{RuntimeError} if the underlying key object is invalid. """ - self.assertEquals(keys.Key(self.rsaObj).privateBlob(), + self.assertEqual(keys.Key(self.rsaObj).privateBlob(), '\x00\x00\x00\x07ssh-rsa\x00\x00\x00\x01\x01' '\x00\x00\x00\x01\x02\x00\x00\x00\x01\x03\x00' '\x00\x00\x01\x04\x00\x00\x00\x01\x04\x00\x00' '\x00\x01\x05') - self.assertEquals(keys.Key(self.dsaObj).privateBlob(), + self.assertEqual(keys.Key(self.dsaObj).privateBlob(), '\x00\x00\x00\x07ssh-dss\x00\x00\x00\x01\x03' '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x02\x00' '\x00\x00\x01\x01\x00\x00\x00\x01\x05') @@ -402,18 +402,18 @@ Test that the Key object generates OpenSSH keys correctly. """ key = keys.Key.fromString(keydata.privateRSA_lsh) - self.assertEquals(key.toString('openssh'), keydata.privateRSA_openssh) - self.assertEquals(key.toString('openssh', 'encrypted'), + self.assertEqual(key.toString('openssh'), keydata.privateRSA_openssh) + self.assertEqual(key.toString('openssh', 'encrypted'), keydata.privateRSA_openssh_encrypted) - self.assertEquals(key.public().toString('openssh'), + self.assertEqual(key.public().toString('openssh'), keydata.publicRSA_openssh[:-8]) # no comment - self.assertEquals(key.public().toString('openssh', 'comment'), + self.assertEqual(key.public().toString('openssh', 'comment'), keydata.publicRSA_openssh) key = keys.Key.fromString(keydata.privateDSA_lsh) - self.assertEquals(key.toString('openssh'), keydata.privateDSA_openssh) - self.assertEquals(key.public().toString('openssh', 'comment'), + self.assertEqual(key.toString('openssh'), keydata.privateDSA_openssh) + self.assertEqual(key.public().toString('openssh', 'comment'), keydata.publicDSA_openssh) - self.assertEquals(key.public().toString('openssh'), + self.assertEqual(key.public().toString('openssh'), keydata.publicDSA_openssh[:-8]) # no comment def test_toLSH(self): @@ -421,12 +421,12 @@ Test that the Key object generates LSH keys correctly. """ key = keys.Key.fromString(keydata.privateRSA_openssh) - self.assertEquals(key.toString('lsh'), keydata.privateRSA_lsh) - self.assertEquals(key.public().toString('lsh'), + self.assertEqual(key.toString('lsh'), keydata.privateRSA_lsh) + self.assertEqual(key.public().toString('lsh'), keydata.publicRSA_lsh) key = keys.Key.fromString(keydata.privateDSA_openssh) - self.assertEquals(key.toString('lsh'), keydata.privateDSA_lsh) - self.assertEquals(key.public().toString('lsh'), + self.assertEqual(key.toString('lsh'), keydata.privateDSA_lsh) + self.assertEqual(key.public().toString('lsh'), keydata.publicDSA_lsh) def test_toAgentv3(self): @@ -434,9 +434,9 @@ Test that the Key object generates Agent v3 keys correctly. """ key = keys.Key.fromString(keydata.privateRSA_openssh) - self.assertEquals(key.toString('agentv3'), keydata.privateRSA_agentv3) + self.assertEqual(key.toString('agentv3'), keydata.privateRSA_agentv3) key = keys.Key.fromString(keydata.privateDSA_openssh) - self.assertEquals(key.toString('agentv3'), keydata.privateDSA_agentv3) + self.assertEqual(key.toString('agentv3'), keydata.privateDSA_agentv3) def test_toStringErrors(self): """ @@ -450,9 +450,9 @@ Test that the Key object generates correct signatures. """ key = keys.Key.fromString(keydata.privateRSA_openssh) - self.assertEquals(key.sign(''), self.rsaSignature) + self.assertEqual(key.sign(''), self.rsaSignature) key = keys.Key.fromString(keydata.privateDSA_openssh) - self.assertEquals(key.sign(''), self.dsaSignature) + self.assertEqual(key.sign(''), self.dsaSignature) def test_verify(self): @@ -472,7 +472,7 @@ """ Test the pretty representation of Key. """ - self.assertEquals(repr(keys.Key(self.rsaObj)), + self.assertEqual(repr(keys.Key(self.rsaObj)), """>> print "hello"']) + return d.addCallback(cb) + + + def test_controlE(self): + """ + CTRL-E can be used as END - setting cursor to end of current + line buffer. + """ + self._testwrite('rint "hello' + '\x01' + 'p' + '\x05' + '"') + d = self.recvlineClient.expect('print "hello"') + def cb(ignore): + self._assertBuffer(['>>> print "hello"']) + return d.addCallback(cb) + + def testDeferred(self): self._testwrite( "from twisted.internet import defer, reactor\n" diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_mixin.py twisted-conch-11.1.0/twisted/conch/test/test_mixin.py --- twisted-conch-11.0.0/twisted/conch/test/test_mixin.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_mixin.py 2011-07-14 19:05:14.000000000 +0000 @@ -40,8 +40,8 @@ for s in L: n = p.rescheduled p.write(s) - self.assertEquals(p.rescheduled, n + 1) - self.assertEquals(t.value(), '') + self.assertEqual(p.rescheduled, n + 1) + self.assertEqual(t.value(), '') p.flush() - self.assertEquals(t.value(), 'foo' + ''.join(L)) + self.assertEqual(t.value(), 'foo' + ''.join(L)) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_openssh_compat.py twisted-conch-11.1.0/twisted/conch/test/test_openssh_compat.py --- twisted-conch-11.0.0/twisted/conch/test/test_openssh_compat.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_openssh_compat.py 2011-07-14 19:05:14.000000000 +0000 @@ -61,7 +61,7 @@ in the data directory """ keys = self.factory.getPublicKeys() - self.assertEquals(len(keys), 1) + self.assertEqual(len(keys), 1) keyTypes = keys.keys() self.assertEqual(keyTypes, ['ssh-rsa']) @@ -72,11 +72,11 @@ keys in the data directory. """ keys = self.factory.getPrivateKeys() - self.assertEquals(len(keys), 2) + self.assertEqual(len(keys), 2) keyTypes = keys.keys() self.assertEqual(set(keyTypes), set(['ssh-rsa', 'ssh-dss'])) - self.assertEquals(self.mockos.seteuidCalls, []) - self.assertEquals(self.mockos.setegidCalls, []) + self.assertEqual(self.mockos.seteuidCalls, []) + self.assertEqual(self.mockos.setegidCalls, []) def test_getPrivateKeysAsRoot(self): @@ -95,8 +95,8 @@ return savedSeteuid(euid) self.patch(os, "seteuid", seteuid) keys = self.factory.getPrivateKeys() - self.assertEquals(len(keys), 2) + self.assertEqual(len(keys), 2) keyTypes = keys.keys() self.assertEqual(set(keyTypes), set(['ssh-rsa', 'ssh-dss'])) - self.assertEquals(self.mockos.seteuidCalls, [0, os.geteuid()]) - self.assertEquals(self.mockos.setegidCalls, [0, os.getegid()]) + self.assertEqual(self.mockos.seteuidCalls, [0, os.geteuid()]) + self.assertEqual(self.mockos.setegidCalls, [0, os.getegid()]) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_recvline.py twisted-conch-11.1.0/twisted/conch/test/test_recvline.py --- twisted-conch-11.0.0/twisted/conch/test/test_recvline.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_recvline.py 2011-09-12 00:06:03.000000000 +0000 @@ -28,181 +28,224 @@ self.pt.makeConnection(self.underlyingTransport) # self.p.makeConnection(self.pt) - def testPrintableCharacters(self): + def test_printableCharacters(self): + """ + When L{HistoricRecvLine} receives a printable character, + it adds it to the current line buffer. + """ self.p.keystrokeReceived('x', None) self.p.keystrokeReceived('y', None) self.p.keystrokeReceived('z', None) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) - def testHorizontalArrows(self): + def test_horizontalArrows(self): + """ + When L{HistoricRecvLine} receives an LEFT_ARROW or + RIGHT_ARROW keystroke it moves the cursor left or right + in the current line buffer, respectively. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz': kR(ch) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.RIGHT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.LEFT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('xy', 'z')) + self.assertEqual(self.p.currentLineBuffer(), ('xy', 'z')) kR(self.pt.LEFT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('x', 'yz')) + self.assertEqual(self.p.currentLineBuffer(), ('x', 'yz')) kR(self.pt.LEFT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('', 'xyz')) + self.assertEqual(self.p.currentLineBuffer(), ('', 'xyz')) kR(self.pt.LEFT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('', 'xyz')) + self.assertEqual(self.p.currentLineBuffer(), ('', 'xyz')) kR(self.pt.RIGHT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('x', 'yz')) + self.assertEqual(self.p.currentLineBuffer(), ('x', 'yz')) kR(self.pt.RIGHT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('xy', 'z')) + self.assertEqual(self.p.currentLineBuffer(), ('xy', 'z')) kR(self.pt.RIGHT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.RIGHT_ARROW) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) - def testNewline(self): + def test_newline(self): + """ + When {HistoricRecvLine} receives a newline, it adds the current + line buffer to the end of its history buffer. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz\nabc\n123\n': kR(ch) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz', 'abc', '123'), ())) kR('c') kR('b') kR('a') - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz', 'abc', '123'), ())) kR('\n') - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz', 'abc', '123', 'cba'), ())) - def testVerticalArrows(self): + def test_verticalArrows(self): + """ + When L{HistoricRecvLine} receives UP_ARROW or DOWN_ARROW + keystrokes it move the current index in the current history + buffer up or down, and resets the current line buffer to the + previous or next line in history, respectively for each. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz\nabc\n123\n': kR(ch) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz', 'abc', '123'), ())) - self.assertEquals(self.p.currentLineBuffer(), ('', '')) + self.assertEqual(self.p.currentLineBuffer(), ('', '')) kR(self.pt.UP_ARROW) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz', 'abc'), ('123',))) - self.assertEquals(self.p.currentLineBuffer(), ('123', '')) + self.assertEqual(self.p.currentLineBuffer(), ('123', '')) kR(self.pt.UP_ARROW) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz',), ('abc', '123'))) - self.assertEquals(self.p.currentLineBuffer(), ('abc', '')) + self.assertEqual(self.p.currentLineBuffer(), ('abc', '')) kR(self.pt.UP_ARROW) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), ((), ('xyz', 'abc', '123'))) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.UP_ARROW) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), ((), ('xyz', 'abc', '123'))) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) for i in range(4): kR(self.pt.DOWN_ARROW) - self.assertEquals(self.p.currentHistoryBuffer(), + self.assertEqual(self.p.currentHistoryBuffer(), (('xyz', 'abc', '123'), ())) - def testHome(self): + def test_home(self): + """ + When L{HistoricRecvLine} receives a HOME keystroke it moves the + cursor to the beginning of the current line buffer. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'hello, world': kR(ch) - self.assertEquals(self.p.currentLineBuffer(), ('hello, world', '')) + self.assertEqual(self.p.currentLineBuffer(), ('hello, world', '')) kR(self.pt.HOME) - self.assertEquals(self.p.currentLineBuffer(), ('', 'hello, world')) + self.assertEqual(self.p.currentLineBuffer(), ('', 'hello, world')) - def testEnd(self): + def test_end(self): + """ + When L{HistoricRecvLine} receives a END keystroke it moves the cursor + to the end of the current line buffer. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'hello, world': kR(ch) - self.assertEquals(self.p.currentLineBuffer(), ('hello, world', '')) + self.assertEqual(self.p.currentLineBuffer(), ('hello, world', '')) kR(self.pt.HOME) kR(self.pt.END) - self.assertEquals(self.p.currentLineBuffer(), ('hello, world', '')) + self.assertEqual(self.p.currentLineBuffer(), ('hello, world', '')) - def testBackspace(self): + def test_backspace(self): + """ + When L{HistoricRecvLine} receives a BACKSPACE keystroke it deletes + the character immediately before the cursor. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz': kR(ch) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.BACKSPACE) - self.assertEquals(self.p.currentLineBuffer(), ('xy', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xy', '')) kR(self.pt.LEFT_ARROW) kR(self.pt.BACKSPACE) - self.assertEquals(self.p.currentLineBuffer(), ('', 'y')) + self.assertEqual(self.p.currentLineBuffer(), ('', 'y')) kR(self.pt.BACKSPACE) - self.assertEquals(self.p.currentLineBuffer(), ('', 'y')) + self.assertEqual(self.p.currentLineBuffer(), ('', 'y')) - def testDelete(self): + def test_delete(self): + """ + When L{HistoricRecvLine} receives a DELETE keystroke, it + delets the character immediately after the cursor. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz': kR(ch) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.DELETE) - self.assertEquals(self.p.currentLineBuffer(), ('xyz', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyz', '')) kR(self.pt.LEFT_ARROW) kR(self.pt.DELETE) - self.assertEquals(self.p.currentLineBuffer(), ('xy', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xy', '')) kR(self.pt.LEFT_ARROW) kR(self.pt.DELETE) - self.assertEquals(self.p.currentLineBuffer(), ('x', '')) + self.assertEqual(self.p.currentLineBuffer(), ('x', '')) kR(self.pt.LEFT_ARROW) kR(self.pt.DELETE) - self.assertEquals(self.p.currentLineBuffer(), ('', '')) + self.assertEqual(self.p.currentLineBuffer(), ('', '')) kR(self.pt.DELETE) - self.assertEquals(self.p.currentLineBuffer(), ('', '')) + self.assertEqual(self.p.currentLineBuffer(), ('', '')) - def testInsert(self): + def test_insert(self): + """ + When not in INSERT mode, L{HistoricRecvLine} inserts the typed + character at the cursor before the next character. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz': kR(ch) - # kR(self.pt.INSERT) - kR(self.pt.LEFT_ARROW) kR('A') - self.assertEquals(self.p.currentLineBuffer(), ('xyA', 'z')) + self.assertEqual(self.p.currentLineBuffer(), ('xyA', 'z')) kR(self.pt.LEFT_ARROW) kR('B') - self.assertEquals(self.p.currentLineBuffer(), ('xyB', 'Az')) + self.assertEqual(self.p.currentLineBuffer(), ('xyB', 'Az')) - def testTypeover(self): + def test_typeover(self): + """ + When in INSERT mode and upon receiving a keystroke with a printable + character, L{HistoricRecvLine} replaces the character at + the cursor with the typed character rather than inserting before. + Ah, the ironies of INSERT mode. + """ kR = lambda ch: self.p.keystrokeReceived(ch, None) for ch in 'xyz': @@ -212,11 +255,25 @@ kR(self.pt.LEFT_ARROW) kR('A') - self.assertEquals(self.p.currentLineBuffer(), ('xyA', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyA', '')) kR(self.pt.LEFT_ARROW) kR('B') - self.assertEquals(self.p.currentLineBuffer(), ('xyB', '')) + self.assertEqual(self.p.currentLineBuffer(), ('xyB', '')) + + + def test_unprintableCharacters(self): + """ + When L{HistoricRecvLine} receives a keystroke for an unprintable + function key with no assigned behavior, the line buffer is unmodified. + """ + kR = lambda ch: self.p.keystrokeReceived(ch, None) + pt = self.pt + + for ch in (pt.F1, pt.F2, pt.F3, pt.F4, pt.F5, pt.F6, pt.F7, pt.F8, + pt.F9, pt.F10, pt.F11, pt.F12, pt.PGUP, pt.PGDN): + kR(ch) + self.assertEqual(self.p.currentLineBuffer(), ('', '')) from twisted.conch import telnet @@ -375,9 +432,9 @@ def _assertBuffer(self, lines): receivedLines = str(self.recvlineClient).splitlines() expectedLines = lines + ([''] * (self.HEIGHT - len(lines) - 1)) - self.assertEquals(len(receivedLines), len(expectedLines)) + self.assertEqual(len(receivedLines), len(expectedLines)) for i in range(len(receivedLines)): - self.assertEquals( + self.assertEqual( receivedLines[i], expectedLines[i], str(receivedLines[max(0, i-1):i+1]) + " != " + @@ -531,8 +588,8 @@ pass def trap(failure): failure.trap(error.ProcessTerminated) - self.assertEquals(failure.value.exitCode, None) - self.assertEquals(failure.value.status, 9) + self.assertEqual(failure.value.exitCode, None) + self.assertEqual(failure.value.status, 9) return self.testTerminal.onDisconnection.addErrback(trap) def _testwrite(self, bytes): diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_scripts.py twisted-conch-11.1.0/twisted/conch/test/test_scripts.py --- twisted-conch-11.0.0/twisted/conch/test/test_scripts.py 1970-01-01 00:00:00.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_scripts.py 2011-10-18 10:31:11.000000000 +0000 @@ -0,0 +1,82 @@ +# Copyright (c) Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Tests for the command-line interfaces to conch. +""" + +try: + import pyasn1 +except ImportError: + pyasn1Skip = "can't run w/o PyASN1" +else: + pyasn1Skip = None + +try: + import Crypto +except ImportError: + cryptoSkip = "can't run w/o PyCrypto" +else: + cryptoSkip = None + +try: + import tty +except ImportError: + ttySkip = "can't run w/o tty" +else: + ttySkip = None + +try: + import Tkinter +except ImportError: + tkskip = "can't run w/o Tkinter" +else: + try: + Tkinter.Tk().destroy() + except Tkinter.TclError, e: + tkskip = "Can't test Tkinter: " + str(e) + else: + tkskip = None + +from twisted.trial.unittest import TestCase +from twisted.scripts.test.test_scripts import ScriptTestsMixin +from twisted.python.test.test_shellcomp import ZshScriptTestMixin + + + +class ScriptTests(TestCase, ScriptTestsMixin): + """ + Tests for the Conch scripts. + """ + skip = pyasn1Skip or cryptoSkip + + + def test_conch(self): + self.scriptTest("conch/conch") + test_conch.skip = ttySkip or skip + + + def test_cftp(self): + self.scriptTest("conch/cftp") + test_cftp.skip = ttySkip or skip + + + def test_ckeygen(self): + self.scriptTest("conch/ckeygen") + + + def test_tkconch(self): + self.scriptTest("conch/tkconch") + test_tkconch.skip = tkskip or skip + + + +class ZshIntegrationTestCase(TestCase, ZshScriptTestMixin): + """ + Test that zsh completion functions are generated without error + """ + generateFor = [('conch', 'twisted.conch.scripts.conch.ClientOptions'), + ('cftp', 'twisted.conch.scripts.cftp.ClientOptions'), + ('ckeygen', 'twisted.conch.scripts.ckeygen.GeneralOptions'), + ('tkconch', 'twisted.conch.scripts.tkconch.GeneralOptions'), + ] diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_session.py twisted-conch-11.1.0/twisted/conch/test/test_session.py --- twisted-conch-11.0.0/twisted/conch/test/test_session.py 2011-03-15 19:34:33.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_session.py 2011-07-14 19:05:14.000000000 +0000 @@ -439,14 +439,14 @@ """ Return an arbitrary L{IAddress}. """ - return IPv4Address('TCP', 'remotehost', '8888') + return IPv4Address('TCP', 'remotehost', 8888) def getHost(self): """ Return an arbitrary L{IAddress}. """ - return IPv4Address('TCP', 'localhost', '9999') + return IPv4Address('TCP', 'localhost', 9999) def write(self, data): @@ -532,7 +532,7 @@ """ s = session.SSHSession(avatar=object) # use object because it doesn't # have an adapter - self.assertEquals(s.buf, '') + self.assertEqual(s.buf, '') self.assertIdentical(s.client, None) self.assertIdentical(s.session, None) @@ -545,7 +545,7 @@ self.session.dataReceived('1') self.session.client = StubClient() self.session.dataReceived('2') - self.assertEquals(self.session.client.transport.buf, '2') + self.assertEqual(self.session.client.transport.buf, '2') def test_client_extReceived(self): """ @@ -557,7 +557,7 @@ self.session.extReceived(255, '2') # 255 is arbitrary self.session.client = StubClient() self.session.extReceived(connection.EXTENDED_DATA_STDERR, '3') - self.assertEquals(self.session.client.transport.err, '3') + self.assertEqual(self.session.client.transport.err, '3') def test_client_extReceivedWithoutWriteErr(self): @@ -645,10 +645,10 @@ self.session.requestReceived('subsystem', common.NS('TestSubsystem') + 'data') - self.assertEquals(self.session.conn.data[self.session], + self.assertEqual(self.session.conn.data[self.session], ['\x00\x00\x00\x0dTestSubsystemdata~']) self.session.dataReceived('more data') - self.assertEquals(self.session.conn.data[self.session][-1], + self.assertEqual(self.session.conn.data[self.session][-1], 'more data~') @@ -670,7 +670,7 @@ RuntimeError). """ errors = self.flushLoggedErrors(RuntimeError) - self.assertEquals(len(errors), 1, "Multiple RuntimeErrors raised: %s" % + self.assertEqual(len(errors), 1, "Multiple RuntimeErrors raised: %s" % '\n'.join([repr(error) for error in errors])) errors[0].trap(RuntimeError) @@ -703,12 +703,12 @@ self.assertTrue(ret) self.assertSessionIsStubSession() self.session.dataReceived('some data\x00') - self.assertEquals(self.session.session.shellTransport.data, + self.assertEqual(self.session.session.shellTransport.data, 'some data\x00') - self.assertEquals(self.session.conn.data[self.session], + self.assertEqual(self.session.conn.data[self.session], ['some data\x00', '\r\n']) self.assertTrue(self.session.session.shellTransport.closed) - self.assertEquals(self.session.conn.requests[self.session], + self.assertEqual(self.session.conn.requests[self.session], [('exit-status', '\x00\x00\x00\x00', False)]) @@ -732,7 +732,7 @@ session.SSHSessionProcessProtocol) self.assertIdentical(self.session.session.execProtocol, self.session.client) - self.assertEquals(self.session.session.execCommandLine, + self.assertEqual(self.session.session.execCommandLine, 'success') @@ -746,14 +746,14 @@ self.assertTrue(ret) self.assertSessionIsStubSession() self.session.dataReceived('some data') - self.assertEquals(self.session.session.execTransport.data, 'some data') - self.assertEquals(self.session.conn.data[self.session], + self.assertEqual(self.session.session.execTransport.data, 'some data') + self.assertEqual(self.session.conn.data[self.session], ['hello', 'some data', '\r\n']) self.session.eofReceived() self.session.closeReceived() self.session.closed() self.assertTrue(self.session.session.execTransport.closed) - self.assertEquals(self.session.conn.requests[self.session], + self.assertEqual(self.session.conn.requests[self.session], [('exit-status', '\x00\x00\x00\x00', False)]) @@ -774,7 +774,7 @@ # 'good' terminal type succeeds self.assertTrue(self.session.requestReceived('pty_req', session.packRequest_pty_req('good', (1, 2, 3, 4), ''))) - self.assertEquals(self.session.session.ptyRequest, + self.assertEqual(self.session.session.ptyRequest, ('good', (1, 2, 3, 4), [])) @@ -792,7 +792,7 @@ self.assertSessionIsStubSession() self.assertTrue(self.session.requestReceived('window_change', session.packRequest_window_change((1, 2, 3, 4)))) - self.assertEquals(self.session.session.windowChange, + self.assertEqual(self.session.session.windowChange, (1, 2, 3, 4)) @@ -908,11 +908,11 @@ protocol.connectionMade() wrapped = session.wrapProtocol(protocol) wrapped.dataReceived('dataReceived') - self.assertEquals(protocol.transport.buf, 'dataReceived') + self.assertEqual(protocol.transport.buf, 'dataReceived') wrapped.write('data') wrapped.writeSequence(['1', '2']) wrapped.loseConnection() - self.assertEquals(protocol.data, 'data12') + self.assertEqual(protocol.data, 'data12') protocol.reason.trap(error.ConnectionDone) def test_wrapProcessProtocol_Protocol(self): @@ -927,7 +927,7 @@ process_protocol = session.wrapProcessProtocol(protocol) process_protocol.connectionMade() process_protocol.outReceived('data') - self.assertEquals(protocol.transport.buf, 'data~') + self.assertEqual(protocol.transport.buf, 'data~') process_protocol.processEnded(failure.Failure( error.ProcessTerminated(0, None, None))) protocol.reason.trap(error.ProcessTerminated) @@ -954,7 +954,7 @@ byte mode number uint32 mode value """ - self.assertEquals(session.parseRequest_pty_req(common.NS('xterm') + + self.assertEqual(session.parseRequest_pty_req(common.NS('xterm') + struct.pack('>4L', 1, 2, 3, 4) + common.NS( @@ -969,7 +969,7 @@ packed = session.packRequest_pty_req('xterm', (2, 1, 3, 4), '\x05\x00\x00\x00\x06') - self.assertEquals(packed, + self.assertEqual(packed, common.NS('xterm') + struct.pack('>4L', 1, 2, 3, 4) + common.NS(struct.pack('>BL', 5, 6))) @@ -980,7 +980,7 @@ """ packed = session.packRequest_pty_req('xterm', (2, 1, 3, 4), '\x05\x00\x00\x00\x06') - self.assertEquals(packed, + self.assertEqual(packed, common.NS('xterm') + struct.pack('>4L', 1, 2, 3, 4) + common.NS(struct.pack('>BL', 5, 6))) @@ -996,7 +996,7 @@ parseRequest_window_change() returns (rows, columns, x pixels, y pixels). """ - self.assertEquals(session.parseRequest_window_change( + self.assertEqual(session.parseRequest_window_change( struct.pack('>4L', 1, 2, 3, 4)), (2, 1, 3, 4)) @@ -1004,7 +1004,7 @@ """ See test_parseRequest_window_change for the payload format. """ - self.assertEquals(session.packRequest_window_change((2, 1, 3, 4)), + self.assertEqual(session.packRequest_window_change((2, 1, 3, 4)), struct.pack('>4L', 1, 2, 3, 4)) @@ -1044,7 +1044,7 @@ SSHSessionProcessProtocol should set self.session to the session passed to the __init__ method. """ - self.assertEquals(self.pp.session, self.session) + self.assertEqual(self.pp.session, self.session) def test_getHost(self): @@ -1052,7 +1052,7 @@ SSHSessionProcessProtocol.getHost() just delegates to its session.conn.transport.getHost(). """ - self.assertEquals( + self.assertEqual( self.session.conn.transport.getHost(), self.pp.getHost()) @@ -1061,7 +1061,7 @@ SSHSessionProcessProtocol.getPeer() just delegates to its session.conn.transport.getPeer(). """ - self.assertEquals( + self.assertEqual( self.session.conn.transport.getPeer(), self.pp.getPeer()) @@ -1072,7 +1072,7 @@ """ self.session.buf = 'buffer' self.pp.connectionMade() - self.assertEquals(self.transport.buf, 'buffer') + self.assertEqual(self.transport.buf, 'buffer') def test_getSignalName(self): @@ -1084,7 +1084,7 @@ signalName = 'SIG' + signalName signalValue = getattr(signal, signalName) sshName = self.pp._getSignalName(signalValue) - self.assertEquals(sshName, signalName, + self.assertEqual(sshName, signalName, "%i: %s != %s" % (signalValue, sshName, signalName)) @@ -1097,7 +1097,7 @@ signal.SIGTwistedTest = signal.NSIG + 1 # value can't exist normally # Force reinitialization of signals self.pp._signalValuesToNames = None - self.assertEquals(self.pp._getSignalName(signal.SIGTwistedTest), + self.assertEqual(self.pp._getSignalName(signal.SIGTwistedTest), 'SIGTwistedTest@' + sys.platform) @@ -1112,7 +1112,7 @@ the session's write method. """ self.pp.outReceived('test data') - self.assertEquals(self.session.conn.data[self.session], + self.assertEqual(self.session.conn.data[self.session], ['test data']) @@ -1122,7 +1122,7 @@ session channel's write method. """ self.pp.write('test data') - self.assertEquals(self.session.conn.data[self.session], + self.assertEqual(self.session.conn.data[self.session], ['test data']) def test_writeSequence(self): @@ -1131,7 +1131,7 @@ joined together and sent to the session channel's write method. """ self.pp.writeSequence(['test ', 'data']) - self.assertEquals(self.session.conn.data[self.session], + self.assertEqual(self.session.conn.data[self.session], ['test data']) @@ -1141,7 +1141,7 @@ the session's writeExtended method. """ self.pp.errReceived('test data') - self.assertEquals(self.session.conn.extData[self.session], + self.assertEqual(self.session.conn.extData[self.session], [(1, 'test data')]) @@ -1253,4 +1253,4 @@ client = session.SSHSessionClient() client.transport = StubTransport() client.dataReceived('test data') - self.assertEquals(client.transport.buf, 'test data') + self.assertEqual(client.transport.buf, 'test data') diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_ssh.py twisted-conch-11.1.0/twisted/conch/test/test_ssh.py --- twisted-conch-11.0.0/twisted/conch/test/test_ssh.py 2011-03-17 02:48:46.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_ssh.py 2011-07-14 19:05:14.000000000 +0000 @@ -311,10 +311,10 @@ def testCounter(self): c = transport._Counter('\x00\x00', 2) for i in xrange(256 * 256): - self.assertEquals(c(), struct.pack('!H', (i + 1) % (2 ** 16))) + self.assertEqual(c(), struct.pack('!H', (i + 1) % (2 ** 16))) # It should wrap around, too. for i in xrange(256 * 256): - self.assertEquals(c(), struct.pack('!H', (i + 1) % (2 ** 16))) + self.assertEqual(c(), struct.pack('!H', (i + 1) % (2 ** 16))) class ConchTestPublicKeyChecker(checkers.SSHPublicKeyDatabase): @@ -593,7 +593,7 @@ d1 = channel.conn.sendGlobalRequest('foo', 'bar', 1) d2 = channel.conn.sendGlobalRequest('foo-2', 'bar2', 1) - d2.addCallback(self.assertEquals, 'data') + d2.addCallback(self.assertEqual, 'data') d3 = self.assertFailure( channel.conn.sendGlobalRequest('bar', 'foo', 1), @@ -603,7 +603,7 @@ channel.addCallback(cbGlobalRequests) def disconnect(ignored): - self.assertEquals( + self.assertEqual( self.realm.avatar.globalRequests, {"foo": "bar", "foo_2": "bar2"}) channel = self.channel @@ -632,8 +632,8 @@ # The server-side object corresponding to our client side channel. session = self.realm.avatar.conn.channels[0].session self.assertIdentical(session.avatar, self.realm.avatar) - self.assertEquals(session._terminalType, 'conch-test-term') - self.assertEquals(session._windowSize, (24, 80, 0, 0)) + self.assertEqual(session._terminalType, 'conch-test-term') + self.assertEqual(session._windowSize, (24, 80, 0, 0)) self.assertTrue(session.ptyReq) channel = self.channel return channel.conn.sendRequest(channel, 'shell', '', 1) @@ -651,7 +651,7 @@ if self.channel.status != 0: log.msg( 'shell exit status was not 0: %i' % (self.channel.status,)) - self.assertEquals( + self.assertEqual( "".join(self.channel.received), 'testing the shell!\x00\r\n') self.assertTrue(self.channel.eofCalled) @@ -680,7 +680,7 @@ # The server logs this exception when it cannot perform the # requested exec. errors = self.flushLoggedErrors(error.ConchError) - self.assertEquals(errors[0].value.args, ('bad exec', None)) + self.assertEqual(errors[0].value.args, ('bad exec', None)) channel.addCallback(cbFailed) return channel @@ -704,7 +704,7 @@ def cbClosed(ignored): # No data is expected - self.assertEquals(self.channel.received, []) + self.assertEqual(self.channel.received, []) self.assertNotEquals(self.channel.status, 0) channel.addCallback(cbClosed) return channel @@ -730,12 +730,12 @@ channel.addCallback(cbExec) def cbClosed(ignored): - self.assertEquals(self.channel.received, []) - self.assertEquals("".join(self.channel.receivedExt), "hello\r\n") - self.assertEquals(self.channel.status, 0) + self.assertEqual(self.channel.received, []) + self.assertEqual("".join(self.channel.receivedExt), "hello\r\n") + self.assertEqual(self.channel.status, 0) self.assertTrue(self.channel.eofCalled) - self.assertEquals(self.channel.localWindowLeft, 4) - self.assertEquals( + self.assertEqual(self.channel.localWindowLeft, 4) + self.assertEqual( self.channel.localWindowLeft, self.realm.avatar._testSession.remoteWindowLeftAtClose) channel.addCallback(cbClosed) @@ -751,8 +751,8 @@ self._ourServerOurClientTest('crazy-unknown-channel'), Exception) def cbFailed(ignored): errors = self.flushLoggedErrors(error.ConchError) - self.assertEquals(errors[0].value.args, (3, 'unknown channel')) - self.assertEquals(len(errors), 1) + self.assertEqual(errors[0].value.args, (3, 'unknown channel')) + self.assertEqual(len(errors), 1) d.addCallback(cbFailed) return d @@ -778,10 +778,10 @@ channel.addCallback(cbExec) def cbClosed(ignored): - self.assertEquals(self.channel.status, 0) - self.assertEquals("".join(self.channel.received), "hello\r\n") - self.assertEquals("".join(self.channel.receivedExt), "hello\r\n") - self.assertEquals(self.channel.localWindowLeft, 11) + self.assertEqual(self.channel.status, 0) + self.assertEqual("".join(self.channel.received), "hello\r\n") + self.assertEqual("".join(self.channel.receivedExt), "hello\r\n") + self.assertEqual(self.channel.localWindowLeft, 11) self.assertTrue(self.channel.eofCalled) channel.addCallback(cbClosed) return channel @@ -807,11 +807,11 @@ channel.addCallback(cbEcho) def cbClosed(ignored): - self.assertEquals(self.channel.status, 0) - self.assertEquals("".join(self.channel.received), "hello\r\n") - self.assertEquals(self.channel.localWindowLeft, 4) + self.assertEqual(self.channel.status, 0) + self.assertEqual("".join(self.channel.received), "hello\r\n") + self.assertEqual(self.channel.localWindowLeft, 4) self.assertTrue(self.channel.eofCalled) - self.assertEquals( + self.assertEqual( self.channel.localWindowLeft, self.realm.avatar._testSession.remoteWindowLeftAtClose) channel.addCallback(cbClosed) @@ -858,7 +858,7 @@ factory = self.makeSSHFactory() factory.protocol = makeProtocol factory.buildProtocol(None) - self.assertEquals([()], calls) + self.assertEqual([()], calls) def test_multipleFactories(self): @@ -894,7 +894,7 @@ L{common.getMP} should parse the a multiple precision integer from a string: a 4-byte length followed by length bytes of the integer. """ - self.assertEquals( + self.assertEqual( self.getMP('\x00\x00\x00\x04\x00\x00\x00\x01'), (1, '')) @@ -904,7 +904,7 @@ L{common.getMP} should be able to parse a big enough integer (that doesn't fit on one byte). """ - self.assertEquals( + self.assertEqual( self.getMP('\x00\x00\x00\x04\x01\x02\x03\x04'), (16909060, '')) @@ -914,7 +914,7 @@ L{common.getMP} has the ability to parse multiple integer in the same string. """ - self.assertEquals( + self.assertEqual( self.getMP('\x00\x00\x00\x04\x00\x00\x00\x01' '\x00\x00\x00\x04\x00\x00\x00\x02', 2), (1, 2, '')) @@ -925,7 +925,7 @@ When more data than needed is sent to L{common.getMP}, it should return the remaining data. """ - self.assertEquals( + self.assertEqual( self.getMP('\x00\x00\x00\x04\x00\x00\x00\x01foo'), (1, 'foo')) @@ -965,19 +965,19 @@ pow gives the correct result when passed a base of type float with a non-integer value. """ - self.assertEquals(6.25, pow(2.5, 2)) + self.assertEqual(6.25, pow(2.5, 2)) def test_intBase(self): """ pow gives the correct result when passed a base of type int. """ - self.assertEquals(81, pow(3, 4)) + self.assertEqual(81, pow(3, 4)) def test_longBase(self): """ pow gives the correct result when passed a base of type long. """ - self.assertEquals(81, pow(3, 4)) + self.assertEqual(81, pow(3, 4)) def test_mpzBase(self): """ @@ -985,7 +985,7 @@ """ if gmpy is None: raise unittest.SkipTest('gmpy not available') - self.assertEquals(81, pow(gmpy.mpz(3), 4)) + self.assertEqual(81, pow(gmpy.mpz(3), 4)) try: diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_tap.py twisted-conch-11.1.0/twisted/conch/test/test_tap.py --- twisted-conch-11.0.0/twisted/conch/test/test_tap.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_tap.py 2011-07-14 19:05:14.000000000 +0000 @@ -57,7 +57,7 @@ config = tap.Options() service = tap.makeService(config) self.assertIsInstance(service, StreamServerEndpointService) - self.assertEquals(service.endpoint._port, 22) + self.assertEqual(service.endpoint._port, 22) self.assertIsInstance(service.factory, OpenSSHFactory) @@ -73,7 +73,7 @@ config = tap.Options() service = tap.makeService(config) portal = service.factory.portal - self.assertEquals( + self.assertEqual( set(portal.checkers.keys()), set([IPluggableAuthenticationModules, ISSHPrivateKey, IUsernamePassword])) @@ -90,6 +90,6 @@ config = tap.Options() service = tap.makeService(config) portal = service.factory.portal - self.assertEquals( + self.assertEqual( set(portal.checkers.keys()), set([ISSHPrivateKey, IUsernamePassword])) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_telnet.py twisted-conch-11.1.0/twisted/conch/test/test_telnet.py --- twisted-conch-11.0.0/twisted/conch/test/test_telnet.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_telnet.py 2011-10-01 08:11:41.000000000 +0000 @@ -7,6 +7,7 @@ """ from zope.interface import implements +from zope.interface.verify import verifyObject from twisted.internet import defer @@ -69,6 +70,16 @@ +class TestInterfaces(unittest.TestCase): + def test_interface(self): + """ + L{telnet.TelnetProtocol} implements L{telnet.ITelnetProtocol} + """ + p = telnet.TelnetProtocol() + verifyObject(telnet.ITelnetProtocol, p) + + + class TelnetTransportTestCase(unittest.TestCase): """ Tests for L{telnet.TelnetTransport}. @@ -93,7 +104,7 @@ for b in L: self.p.dataReceived(b) - self.assertEquals(h.bytes, ''.join(L)) + self.assertEqual(h.bytes, ''.join(L)) def testNewlineHandling(self): # Send various kinds of newlines and make sure they get translated @@ -108,7 +119,7 @@ for b in L: self.p.dataReceived(b) - self.assertEquals(h.bytes, L[0][:-2] + '\n' + + self.assertEqual(h.bytes, L[0][:-2] + '\n' + L[1][:-2] + '\r' + L[2][:-2] + '\n' + L[3][:-2] + '\r') @@ -126,7 +137,7 @@ for b in L: self.p.dataReceived(b) - self.assertEquals(h.bytes, ''.join(L).replace('\xff\xff', '\xff')) + self.assertEqual(h.bytes, ''.join(L).replace('\xff\xff', '\xff')) def _simpleCommandTest(self, cmdName): # Send a single simple telnet command and make sure @@ -141,8 +152,8 @@ for b in L: self.p.dataReceived(b) - self.assertEquals(h.calls, [cmdName]) - self.assertEquals(h.bytes, ''.join(L).replace(cmd, '')) + self.assertEqual(h.calls, [cmdName]) + self.assertEqual(h.bytes, ''.join(L).replace(cmd, '')) def testInterrupt(self): self._simpleCommandTest("IP") @@ -183,8 +194,8 @@ for b in L: self.p.dataReceived(b) - self.assertEquals(h.bytes, ''.join(L).replace(cmd, '')) - self.assertEquals(h.subcmd, list("hello world")) + self.assertEqual(h.bytes, ''.join(L).replace(cmd, '')) + self.assertEqual(h.subcmd, list("hello world")) def testSubnegotiationWithEmbeddedSE(self): # Send a subnegotiation command with an embedded SE. Make sure @@ -201,8 +212,8 @@ for b in L: self.p.dataReceived(b) - self.assertEquals(h.bytes, ''.join(L).replace(cmd, '')) - self.assertEquals(h.subcmd, [telnet.SE]) + self.assertEqual(h.bytes, ''.join(L).replace(cmd, '')) + self.assertEqual(h.subcmd, [telnet.SE]) def testBoundarySubnegotiation(self): # Send a subnegotiation command. Split it at every possible byte boundary @@ -223,14 +234,14 @@ for bytes in L: self.p.dataReceived(bytes) - self.assertEquals(h.bytes, ''.join(L).replace(cmd, '')) - self.assertEquals(h.subcmd, [telnet.SE] + list('hello')) + self.assertEqual(h.bytes, ''.join(L).replace(cmd, '')) + self.assertEqual(h.subcmd, [telnet.SE] + list('hello')) def _enabledHelper(self, o, eL=[], eR=[], dL=[], dR=[]): - self.assertEquals(o.enabledLocal, eL) - self.assertEquals(o.enabledRemote, eR) - self.assertEquals(o.disabledLocal, dL) - self.assertEquals(o.disabledRemote, dR) + self.assertEqual(o.enabledLocal, eL) + self.assertEqual(o.enabledRemote, eR) + self.assertEqual(o.disabledLocal, dL) + self.assertEqual(o.disabledRemote, dR) def testRefuseWill(self): # Try to enable an option. The server should refuse to enable it. @@ -239,8 +250,8 @@ bytes = "surrounding bytes" + cmd + "to spice things up" self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), telnet.IAC + telnet.DONT + '\x12') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), telnet.IAC + telnet.DONT + '\x12') self._enabledHelper(self.p.protocol) def testRefuseDo(self): @@ -250,8 +261,8 @@ bytes = "surrounding bytes" + cmd + "to spice things up" self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), telnet.IAC + telnet.WONT + '\x12') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), telnet.IAC + telnet.WONT + '\x12') self._enabledHelper(self.p.protocol) def testAcceptDo(self): @@ -264,7 +275,7 @@ h.localEnableable = ('\x19',) self.p.dataReceived(bytes) - self.assertEquals(self.t.value(), telnet.IAC + telnet.WILL + '\x19') + self.assertEqual(self.t.value(), telnet.IAC + telnet.WILL + '\x19') self._enabledHelper(h, eL=['\x19']) def testAcceptWill(self): @@ -276,7 +287,7 @@ h.remoteEnableable = ('\x91',) self.p.dataReceived(bytes) - self.assertEquals(self.t.value(), telnet.IAC + telnet.DO + '\x91') + self.assertEqual(self.t.value(), telnet.IAC + telnet.DO + '\x91') self._enabledHelper(h, eR=['\x91']) def testAcceptWont(self): @@ -294,9 +305,9 @@ bytes = "fiddle dee" + cmd self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), telnet.IAC + telnet.DONT + '\x29') - self.assertEquals(s.him.state, 'no') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), telnet.IAC + telnet.DONT + '\x29') + self.assertEqual(s.him.state, 'no') self._enabledHelper(self.p.protocol, dR=['\x29']) def testAcceptDont(self): @@ -314,9 +325,9 @@ bytes = "fiddle dum " + cmd self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), telnet.IAC + telnet.WONT + '\x29') - self.assertEquals(s.us.state, 'no') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), telnet.IAC + telnet.WONT + '\x29') + self.assertEqual(s.us.state, 'no') self._enabledHelper(self.p.protocol, dL=['\x29']) def testIgnoreWont(self): @@ -327,8 +338,8 @@ bytes = "dum de dum" + cmd + "tra la la" self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), '') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), '') self._enabledHelper(self.p.protocol) def testIgnoreDont(self): @@ -340,8 +351,8 @@ bytes = "dum de dum" + cmd + "tra la la" self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), '') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), '') self._enabledHelper(self.p.protocol) def testIgnoreWill(self): @@ -359,8 +370,8 @@ bytes = "tra la la" + cmd + "dum de dum" self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), '') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), '') self._enabledHelper(self.p.protocol) def testIgnoreDo(self): @@ -378,8 +389,8 @@ bytes = "tra la la" + cmd + "dum de dum" self.p.dataReceived(bytes) - self.assertEquals(self.p.protocol.bytes, bytes.replace(cmd, '')) - self.assertEquals(self.t.value(), '') + self.assertEqual(self.p.protocol.bytes, bytes.replace(cmd, '')) + self.assertEqual(self.t.value(), '') self._enabledHelper(self.p.protocol) def testAcceptedEnableRequest(self): @@ -392,11 +403,11 @@ h = self.p.protocol h.remoteEnableable = ('\x42',) - self.assertEquals(self.t.value(), telnet.IAC + telnet.DO + '\x42') + self.assertEqual(self.t.value(), telnet.IAC + telnet.DO + '\x42') self.p.dataReceived(telnet.IAC + telnet.WILL + '\x42') - d.addCallback(self.assertEquals, True) + d.addCallback(self.assertEqual, True) d.addCallback(lambda _: self._enabledHelper(h, eR=['\x42'])) return d @@ -414,20 +425,20 @@ self.p.protocol.remoteEnableable = ('\x42',) d = self.p.do('\x42') - self.assertEquals(self.t.value(), telnet.IAC + telnet.DO + '\x42') + self.assertEqual(self.t.value(), telnet.IAC + telnet.DO + '\x42') s = self.p.getOptionState('\x42') - self.assertEquals(s.him.state, 'no') - self.assertEquals(s.us.state, 'no') - self.assertEquals(s.him.negotiating, True) - self.assertEquals(s.us.negotiating, False) + self.assertEqual(s.him.state, 'no') + self.assertEqual(s.us.state, 'no') + self.assertEqual(s.him.negotiating, True) + self.assertEqual(s.us.negotiating, False) self.p.dataReceived(telnet.IAC + telnet.WONT + '\x42') d = self.assertFailure(d, telnet.OptionRefused) d.addCallback(lambda ignored: self._enabledHelper(self.p.protocol)) d.addCallback( - lambda ignored: self.assertEquals(s.him.negotiating, False)) + lambda ignored: self.assertEqual(s.him.negotiating, False)) return d @@ -444,20 +455,20 @@ self.p.protocol.localEnableable = ('\x42',) d = self.p.will('\x42') - self.assertEquals(self.t.value(), telnet.IAC + telnet.WILL + '\x42') + self.assertEqual(self.t.value(), telnet.IAC + telnet.WILL + '\x42') s = self.p.getOptionState('\x42') - self.assertEquals(s.him.state, 'no') - self.assertEquals(s.us.state, 'no') - self.assertEquals(s.him.negotiating, False) - self.assertEquals(s.us.negotiating, True) + self.assertEqual(s.him.state, 'no') + self.assertEqual(s.us.state, 'no') + self.assertEqual(s.him.negotiating, False) + self.assertEqual(s.us.negotiating, True) self.p.dataReceived(telnet.IAC + telnet.DONT + '\x42') d = self.assertFailure(d, telnet.OptionRefused) d.addCallback(lambda ignored: self._enabledHelper(self.p.protocol)) d.addCallback( - lambda ignored: self.assertEquals(s.us.negotiating, False)) + lambda ignored: self.assertEqual(s.us.negotiating, False)) return d @@ -471,11 +482,11 @@ d = self.p.dont('\x42') - self.assertEquals(self.t.value(), telnet.IAC + telnet.DONT + '\x42') + self.assertEqual(self.t.value(), telnet.IAC + telnet.DONT + '\x42') self.p.dataReceived(telnet.IAC + telnet.WONT + '\x42') - d.addCallback(self.assertEquals, True) + d.addCallback(self.assertEqual, True) d.addCallback(lambda _: self._enabledHelper(self.p.protocol, dR=['\x42'])) return d @@ -504,7 +515,7 @@ self.p.protocol.remoteEnableable = ('\x24',) d = self.p.do('\x24') self.p.dataReceived(telnet.IAC + telnet.WILL + '\x24') - d.addCallback(self.assertEquals, True) + d.addCallback(self.assertEqual, True) d.addCallback(lambda _: self._enabledHelper(self.p.protocol, eR=['\x24'], dR=['\x24'])) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_text.py twisted-conch-11.1.0/twisted/conch/test/test_text.py --- twisted-conch-11.0.0/twisted/conch/test/test_text.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_text.py 2011-07-14 19:05:14.000000000 +0000 @@ -13,46 +13,46 @@ self.attrs = helper.CharacterAttribute() def testTrivial(self): - self.assertEquals( + self.assertEqual( text.flatten(A.normal['Hello, world.'], self.attrs), 'Hello, world.') def testBold(self): - self.assertEquals( + self.assertEqual( text.flatten(A.bold['Hello, world.'], self.attrs), '\x1b[1mHello, world.') def testUnderline(self): - self.assertEquals( + self.assertEqual( text.flatten(A.underline['Hello, world.'], self.attrs), '\x1b[4mHello, world.') def testBlink(self): - self.assertEquals( + self.assertEqual( text.flatten(A.blink['Hello, world.'], self.attrs), '\x1b[5mHello, world.') def testReverseVideo(self): - self.assertEquals( + self.assertEqual( text.flatten(A.reverseVideo['Hello, world.'], self.attrs), '\x1b[7mHello, world.') def testMinus(self): - self.assertEquals( + self.assertEqual( text.flatten( A.bold[A.blink['Hello', -A.bold[' world'], '.']], self.attrs), '\x1b[1;5mHello\x1b[0;5m world\x1b[1;5m.') def testForeground(self): - self.assertEquals( + self.assertEqual( text.flatten( A.normal[A.fg.red['Hello, '], A.fg.green['world!']], self.attrs), '\x1b[31mHello, \x1b[32mworld!') def testBackground(self): - self.assertEquals( + self.assertEqual( text.flatten( A.normal[A.bg.red['Hello, '], A.bg.green['world!']], self.attrs), @@ -82,7 +82,7 @@ A.fg.green[ "Foreground Green, Background Cyan, Bold"]]]] - self.assertEquals( + self.assertEqual( text.flatten(output, self.attrs), "\x1b[1;31;46mForeground Red, Background Cyan, Bold" "\x1b[5mBlinking" @@ -90,11 +90,11 @@ "\x1b[1;32;46mForeground Green, Background Cyan, Bold") def testNesting(self): - self.assertEquals( + self.assertEqual( text.flatten(A.bold['Hello, ', A.underline['world.']], self.attrs), '\x1b[1mHello, \x1b[4mworld.') - self.assertEquals( + self.assertEqual( text.flatten( A.bold[A.reverseVideo['Hello, ', A.normal['world'], '.']], self.attrs), diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_transport.py twisted-conch-11.1.0/twisted/conch/test/test_transport.py --- twisted-conch-11.0.0/twisted/conch/test/test_transport.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_transport.py 2011-07-14 19:05:14.000000000 +0000 @@ -410,7 +410,7 @@ string. """ # the other setup was done in the setup method - self.assertEquals(self.transport.value().split('\r\n', 1)[0], + self.assertEqual(self.transport.value().split('\r\n', 1)[0], "SSH-2.0-Twisted") @@ -432,7 +432,7 @@ payload = 'BCDEFG' proto.sendPacket(message, payload) value = self.transport.value() - self.assertEquals(value, '\x00\x00\x00\x0c\x04ABCDEFG\x99\x99\x99\x99') + self.assertEqual(value, '\x00\x00\x00\x0c\x04ABCDEFG\x99\x99\x99\x99') def test_sendPacketEncrypted(self): @@ -450,7 +450,7 @@ proto.sendPacket(message, payload) self.assertTrue(testCipher.usedEncrypt) value = self.transport.value() - self.assertEquals( + self.assertEqual( value, # Four byte length prefix '\x00\x00\x00\x08' @@ -476,7 +476,7 @@ self.transport.clear() proto.sendPacket(ord('A'), 'B') value = self.transport.value() - self.assertEquals( + self.assertEqual( value, '\x00\x00\x00\x0c\x08BA\x66\x99\x99\x99\x99\x99\x99\x99\x99') @@ -498,7 +498,7 @@ proto.sendPacket(message, payload) self.assertTrue(testCipher.usedEncrypt) value = self.transport.value() - self.assertEquals( + self.assertEqual( value, # Four byte length prefix '\x00\x00\x00\x0e' @@ -523,8 +523,8 @@ self.transport.clear() proto.sendPacket(ord('A'), 'BC') proto.buf = self.transport.value() + 'extra' - self.assertEquals(proto.getPacket(), 'ABC') - self.assertEquals(proto.buf, 'extra') + self.assertEqual(proto.getPacket(), 'ABC') + self.assertEqual(proto.buf, 'extra') def test_getPacketEncrypted(self): @@ -540,12 +540,12 @@ proto.sendPacket(ord('A'), 'BCD') value = self.transport.value() proto.buf = value[:MockCipher.decBlockSize] - self.assertEquals(proto.getPacket(), None) + self.assertEqual(proto.getPacket(), None) self.assertTrue(testCipher.usedDecrypt) - self.assertEquals(proto.first, '\x00\x00\x00\x0e\x09A') + self.assertEqual(proto.first, '\x00\x00\x00\x0e\x09A') proto.buf += value[MockCipher.decBlockSize:] - self.assertEquals(proto.getPacket(), 'ABCD') - self.assertEquals(proto.buf, '') + self.assertEqual(proto.getPacket(), 'ABCD') + self.assertEqual(proto.buf, '') def test_getPacketCompressed(self): @@ -561,7 +561,7 @@ proto.incomingCompression = proto.outgoingCompression proto.sendPacket(ord('A'), 'BCD') proto.buf = self.transport.value() - self.assertEquals(proto.getPacket(), 'ABCD') + self.assertEqual(proto.getPacket(), 'ABCD') def test_getPacketBoth(self): @@ -578,7 +578,7 @@ proto.incomingCompression = proto.outgoingCompression proto.sendPacket(ord('A'), 'BCDEFG') proto.buf = self.transport.value() - self.assertEquals(proto.getPacket(), 'ABCDEFG') + self.assertEqual(proto.getPacket(), 'ABCDEFG') def test_ciphersAreValid(self): @@ -610,25 +610,25 @@ value = self.transport.value().split('\r\n', 1)[1] self.proto.buf = value packet = self.proto.getPacket() - self.assertEquals(packet[0], chr(transport.MSG_KEXINIT)) - self.assertEquals(packet[1:17], '\x99' * 16) + self.assertEqual(packet[0], chr(transport.MSG_KEXINIT)) + self.assertEqual(packet[1:17], '\x99' * 16) (kex, pubkeys, ciphers1, ciphers2, macs1, macs2, compressions1, compressions2, languages1, languages2, buf) = common.getNS(packet[17:], 10) - self.assertEquals(kex, ','.join(self.proto.supportedKeyExchanges)) - self.assertEquals(pubkeys, ','.join(self.proto.supportedPublicKeys)) - self.assertEquals(ciphers1, ','.join(self.proto.supportedCiphers)) - self.assertEquals(ciphers2, ','.join(self.proto.supportedCiphers)) - self.assertEquals(macs1, ','.join(self.proto.supportedMACs)) - self.assertEquals(macs2, ','.join(self.proto.supportedMACs)) - self.assertEquals(compressions1, + self.assertEqual(kex, ','.join(self.proto.supportedKeyExchanges)) + self.assertEqual(pubkeys, ','.join(self.proto.supportedPublicKeys)) + self.assertEqual(ciphers1, ','.join(self.proto.supportedCiphers)) + self.assertEqual(ciphers2, ','.join(self.proto.supportedCiphers)) + self.assertEqual(macs1, ','.join(self.proto.supportedMACs)) + self.assertEqual(macs2, ','.join(self.proto.supportedMACs)) + self.assertEqual(compressions1, ','.join(self.proto.supportedCompressions)) - self.assertEquals(compressions2, + self.assertEqual(compressions2, ','.join(self.proto.supportedCompressions)) - self.assertEquals(languages1, ','.join(self.proto.supportedLanguages)) - self.assertEquals(languages2, ','.join(self.proto.supportedLanguages)) - self.assertEquals(buf, '\x00' * 5) + self.assertEqual(languages1, ','.join(self.proto.supportedLanguages)) + self.assertEqual(languages2, ','.join(self.proto.supportedLanguages)) + self.assertEqual(buf, '\x00' * 5) def test_receiveKEXINITReply(self): @@ -639,7 +639,7 @@ self.transport.clear() self.proto.dispatchMessage( transport.MSG_KEXINIT, self._A_KEXINIT_MESSAGE) - self.assertEquals(self.packets, []) + self.assertEqual(self.packets, []) def test_sendKEXINITReply(self): @@ -652,8 +652,8 @@ self.proto.dispatchMessage( transport.MSG_KEXINIT, self._A_KEXINIT_MESSAGE) - self.assertEquals(len(self.packets), 1) - self.assertEquals(self.packets[0][0], transport.MSG_KEXINIT) + self.assertEqual(len(self.packets), 1) + self.assertEqual(self.packets[0][0], transport.MSG_KEXINIT) def test_sendKexInitTwiceFails(self): @@ -690,7 +690,7 @@ for messageType in disallowedMessageTypes: self.proto.sendPacket(messageType, 'foo') - self.assertEquals(self.transport.value(), "") + self.assertEqual(self.transport.value(), "") self.finishKeyExchange(self.proto) # Make the bytes written to the transport cleartext so it's easier to @@ -700,7 +700,7 @@ # Pseudo-deliver the peer's NEWKEYS message, which should flush the # messages which were queued above. self.proto._newKeys() - self.assertEquals(self.transport.value().count("foo"), 2) + self.assertEqual(self.transport.value().count("foo"), 2) def test_sendDebug(self): @@ -711,7 +711,7 @@ string language """ self.proto.sendDebug("test", True, 'en') - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_DEBUG, "\x01\x00\x00\x00\x04test\x00\x00\x00\x02en")]) @@ -724,7 +724,7 @@ self.proto.dispatchMessage( transport.MSG_DEBUG, '\x01\x00\x00\x00\x04test\x00\x00\x00\x02en') - self.assertEquals(self.proto.debugs, [(True, 'test', 'en')]) + self.assertEqual(self.proto.debugs, [(True, 'test', 'en')]) def test_sendIgnore(self): @@ -733,7 +733,7 @@ string ignored data """ self.proto.sendIgnore("test") - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_IGNORE, '\x00\x00\x00\x04test')]) @@ -744,7 +744,7 @@ test_sendIgnore. """ self.proto.dispatchMessage(transport.MSG_IGNORE, 'test') - self.assertEquals(self.proto.ignoreds, ['test']) + self.assertEqual(self.proto.ignoreds, ['test']) def test_sendUnimplemented(self): @@ -753,7 +753,7 @@ uint32 sequence number """ self.proto.sendUnimplemented() - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_UNIMPLEMENTED, '\x00\x00\x00\x00')]) @@ -765,7 +765,7 @@ """ self.proto.dispatchMessage(transport.MSG_UNIMPLEMENTED, '\x00\x00\x00\xff') - self.assertEquals(self.proto.unimplementeds, [255]) + self.assertEqual(self.proto.unimplementeds, [255]) def test_sendDisconnect(self): @@ -780,7 +780,7 @@ disconnected[0] = True self.transport.loseConnection = stubLoseConnection self.proto.sendDisconnect(0xff, "test") - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_DISCONNECT, "\x00\x00\x00\xff\x00\x00\x00\x04test\x00\x00\x00\x00")]) @@ -798,7 +798,7 @@ self.transport.loseConnection = stubLoseConnection self.proto.dispatchMessage(transport.MSG_DISCONNECT, '\x00\x00\x00\xff\x00\x00\x00\x04test') - self.assertEquals(self.proto.errors, [(255, 'test')]) + self.assertEqual(self.proto.errors, [(255, 'test')]) self.assertTrue(disconnected[0]) @@ -813,7 +813,7 @@ self.proto.ssh_KEXINIT = stubKEXINIT self.proto.dataReceived(self.transport.value()) self.assertTrue(self.proto.gotVersion) - self.assertEquals(self.proto.ourVersionString, + self.assertEqual(self.proto.ourVersionString, self.proto.otherVersionString) self.assertTrue(kexInit[0]) @@ -825,10 +825,10 @@ """ service = MockService() self.proto.setService(service) - self.assertEquals(self.proto.service, service) + self.assertEqual(self.proto.service, service) self.assertTrue(service.started) self.proto.dispatchMessage(0xff, "test") - self.assertEquals(self.packets, [(0xff, "test")]) + self.assertEqual(self.packets, [(0xff, "test")]) service2 = MockService() self.proto.setService(service2) @@ -903,8 +903,8 @@ disconnected[0] = True self.transport.loseConnection = stubLoseConnection self.proto.loseConnection() - self.assertEquals(self.packets[0][0], transport.MSG_DISCONNECT) - self.assertEquals(self.packets[0][1][3], + self.assertEqual(self.packets[0][0], transport.MSG_DISCONNECT) + self.assertEqual(self.packets[0][1][3], chr(transport.DISCONNECT_CONNECTION_LOST)) @@ -922,8 +922,8 @@ for c in version + '\r\n': self.proto.dataReceived(c) self.assertTrue(disconnected[0]) - self.assertEquals(self.packets[0][0], transport.MSG_DISCONNECT) - self.assertEquals( + self.assertEqual(self.packets[0][0], transport.MSG_DISCONNECT) + self.assertEqual( self.packets[0][1][3], chr(transport.DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED)) testBad('SSH-1.5-OpenSSH') @@ -942,7 +942,7 @@ """ + proto.ourVersionString + "\r\n") [proto.dataReceived(c) for c in data] self.assertTrue(proto.gotVersion) - self.assertEquals(proto.otherVersionString, proto.ourVersionString) + self.assertEqual(proto.otherVersionString, proto.ourVersionString) def test_compatabilityVersion(self): @@ -954,7 +954,7 @@ proto.makeConnection(proto_helpers.StringTransport()) proto.dataReceived("SSH-1.99-OpenSSH\n") self.assertTrue(proto.gotVersion) - self.assertEquals(proto.otherVersionString, "SSH-1.99-OpenSSH") + self.assertEqual(proto.otherVersionString, "SSH-1.99-OpenSSH") def test_supportedVersionsAreAllowed(self): @@ -978,7 +978,7 @@ proto.supportedVersions = ("2.0", ) proto.makeConnection(proto_helpers.StringTransport()) proto.dataReceived("SSH-9.99-OpenSSH\n") - self.assertEquals("9.99", proto.gotUnsupportedVersion) + self.assertEqual("9.99", proto.gotUnsupportedVersion) def test_badPackets(self): @@ -989,10 +989,10 @@ def testBad(packet, error=transport.DISCONNECT_PROTOCOL_ERROR): self.packets = [] self.proto.buf = packet - self.assertEquals(self.proto.getPacket(), None) - self.assertEquals(len(self.packets), 1) - self.assertEquals(self.packets[0][0], transport.MSG_DISCONNECT) - self.assertEquals(self.packets[0][1][3], chr(error)) + self.assertEqual(self.proto.getPacket(), None) + self.assertEqual(len(self.packets), 1) + self.assertEqual(self.packets[0][0], transport.MSG_DISCONNECT) + self.assertEqual(self.packets[0][1][3], chr(error)) testBad('\xff' * 8) # big packet testBad('\x00\x00\x00\x05\x00BCDE') # length not modulo blocksize @@ -1019,9 +1019,9 @@ """ seqnum = self.proto.incomingPacketSequence def checkUnimplemented(seqnum=seqnum): - self.assertEquals(self.packets[0][0], + self.assertEqual(self.packets[0][0], transport.MSG_UNIMPLEMENTED) - self.assertEquals(self.packets[0][1][3], chr(seqnum)) + self.assertEqual(self.packets[0][1][3], chr(seqnum)) self.proto.packets = [] seqnum += 1 @@ -1047,7 +1047,7 @@ k1 = sha1('AB' + 'CD' + 'K' + self.proto.sessionID).digest() k2 = sha1('ABCD' + k1).digest() - self.assertEquals(self.proto._getKey('K', 'AB', 'CD'), k1 + k2) + self.assertEqual(self.proto._getKey('K', 'AB', 'CD'), k1 + k2) def test_multipleClasses(self): @@ -1087,8 +1087,8 @@ """ if kind is None: kind = transport.DISCONNECT_PROTOCOL_ERROR - self.assertEquals(self.packets[-1][0], transport.MSG_DISCONNECT) - self.assertEquals(self.packets[-1][1][3], chr(kind)) + self.assertEqual(self.packets[-1][0], transport.MSG_DISCONNECT) + self.assertEqual(self.packets[-1][1][3], chr(kind)) def connectModifiedProtocol(self, protoModification, @@ -1194,19 +1194,19 @@ '\tnone,zlib\x00\x00\x00\tnone,zlib\x00\x00\x00\x00\x00\x00' '\x00\x00\x00\x00\x00\x00\x00\x99\x99\x99\x99\x99\x99\x99\x99' '\x99') - self.assertEquals(self.proto.kexAlg, + self.assertEqual(self.proto.kexAlg, 'diffie-hellman-group1-sha1') - self.assertEquals(self.proto.keyAlg, + self.assertEqual(self.proto.keyAlg, 'ssh-dss') - self.assertEquals(self.proto.outgoingCompressionType, + self.assertEqual(self.proto.outgoingCompressionType, 'none') - self.assertEquals(self.proto.incomingCompressionType, + self.assertEqual(self.proto.incomingCompressionType, 'none') ne = self.proto.nextEncryptions - self.assertEquals(ne.outCipType, 'aes128-ctr') - self.assertEquals(ne.inCipType, 'aes128-ctr') - self.assertEquals(ne.outMACType, 'hmac-md5') - self.assertEquals(ne.inMACType, 'hmac-md5') + self.assertEqual(ne.outCipType, 'aes128-ctr') + self.assertEqual(ne.inCipType, 'aes128-ctr') + self.assertEqual(ne.outMACType, 'hmac-md5') + self.assertEqual(ne.inMACType, 'hmac-md5') def test_ignoreGuessPacketKex(self): @@ -1239,12 +1239,12 @@ self.proto.ssh_KEX_DH_GEX_REQUEST_OLD('\x00\x00\x08\x00') self.assertFalse(self.proto.ignoreNextPacket) - self.assertEquals(self.packets, []) + self.assertEqual(self.packets, []) self.proto.ignoreNextPacket = True self.proto.ssh_KEX_DH_GEX_REQUEST('\x00\x00\x08\x00' * 3) self.assertFalse(self.proto.ignoreNextPacket) - self.assertEquals(self.packets, []) + self.assertEqual(self.packets, []) def test_ignoreGuessPacketKey(self): @@ -1273,12 +1273,12 @@ self.proto.ssh_KEX_DH_GEX_REQUEST_OLD('\x00\x00\x08\x00') self.assertFalse(self.proto.ignoreNextPacket) - self.assertEquals(self.packets, []) + self.assertEqual(self.packets, []) self.proto.ignoreNextPacket = True self.proto.ssh_KEX_DH_GEX_REQUEST('\x00\x00\x08\x00' * 3) self.assertFalse(self.proto.ignoreNextPacket) - self.assertEquals(self.packets, []) + self.assertEqual(self.packets, []) def test_KEXDH_INIT(self): @@ -1309,7 +1309,7 @@ signature = self.proto.factory.privateKeys['ssh-rsa'].sign( exchangeHash) - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_KEXDH_REPLY, common.NS(self.proto.factory.publicKeys['ssh-rsa'].blob()) @@ -1328,12 +1328,12 @@ self.proto.supportedPublicKeys = ['ssh-rsa'] self.proto.dataReceived(self.transport.value()) self.proto.ssh_KEX_DH_GEX_REQUEST_OLD('\x00\x00\x04\x00') - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_KEX_DH_GEX_GROUP, common.MP(transport.DH_PRIME) + '\x00\x00\x00\x01\x02')]) - self.assertEquals(self.proto.g, 2) - self.assertEquals(self.proto.p, transport.DH_PRIME) + self.assertEqual(self.proto.g, 2) + self.assertEqual(self.proto.p, transport.DH_PRIME) def test_KEX_DH_GEX_REQUEST_OLD_badKexAlg(self): @@ -1359,12 +1359,12 @@ self.proto.dataReceived(self.transport.value()) self.proto.ssh_KEX_DH_GEX_REQUEST('\x00\x00\x04\x00\x00\x00\x08\x00' + '\x00\x00\x0c\x00') - self.assertEquals( + self.assertEqual( self.packets, [(transport.MSG_KEX_DH_GEX_GROUP, common.MP(transport.DH_PRIME) + '\x00\x00\x00\x01\x03')]) - self.assertEquals(self.proto.g, 3) - self.assertEquals(self.proto.p, transport.DH_PRIME) + self.assertEqual(self.proto.g, 3) + self.assertEqual(self.proto.p, transport.DH_PRIME) def test_KEX_DH_GEX_INIT_after_REQUEST(self): @@ -1390,7 +1390,7 @@ h.update(sharedSecret) exchangeHash = h.digest() self.proto.ssh_KEX_DH_GEX_INIT(common.MP(e)) - self.assertEquals( + self.assertEqual( self.packets[1], (transport.MSG_KEX_DH_GEX_REPLY, common.NS(self.proto.factory.publicKeys['ssh-rsa'].blob()) + @@ -1421,7 +1421,7 @@ h.update(sharedSecret) exchangeHash = h.digest() self.proto.ssh_KEX_DH_GEX_INIT(common.MP(e)) - self.assertEquals( + self.assertEqual( self.packets[1:], [(transport.MSG_KEX_DH_GEX_REPLY, common.NS(self.proto.factory.publicKeys['ssh-rsa'].blob()) + @@ -1436,12 +1436,12 @@ """ self.proto.nextEncryptions = MockCipher() self.simulateKeyExchange('AB', 'CD') - self.assertEquals(self.proto.sessionID, 'CD') + self.assertEqual(self.proto.sessionID, 'CD') self.simulateKeyExchange('AB', 'EF') - self.assertEquals(self.proto.sessionID, 'CD') - self.assertEquals(self.packets[-1], (transport.MSG_NEWKEYS, '')) + self.assertEqual(self.proto.sessionID, 'CD') + self.assertEqual(self.packets[-1], (transport.MSG_NEWKEYS, '')) newKeys = [self.proto._getKey(c, 'AB', 'EF') for c in 'ABCDEF'] - self.assertEquals( + self.assertEqual( self.proto.nextEncryptions.keys, (newKeys[1], newKeys[3], newKeys[0], newKeys[2], newKeys[5], newKeys[4])) @@ -1477,9 +1477,9 @@ service. """ self.proto.ssh_SERVICE_REQUEST(common.NS('ssh-userauth')) - self.assertEquals(self.packets, [(transport.MSG_SERVICE_ACCEPT, + self.assertEqual(self.packets, [(transport.MSG_SERVICE_ACCEPT, common.NS('ssh-userauth'))]) - self.assertEquals(self.proto.service.name, 'MockService') + self.assertEqual(self.proto.service.name, 'MockService') def test_disconnectNEWKEYSData(self): @@ -1528,19 +1528,19 @@ '\tzlib,none\x00\x00\x00\tzlib,none\x00\x00\x00\x00\x00\x00' '\x00\x00\x00\x00\x00\x00\x00\x99\x99\x99\x99\x99\x99\x99\x99' '\x99') - self.assertEquals(self.proto.kexAlg, + self.assertEqual(self.proto.kexAlg, 'diffie-hellman-group-exchange-sha1') - self.assertEquals(self.proto.keyAlg, + self.assertEqual(self.proto.keyAlg, 'ssh-rsa') - self.assertEquals(self.proto.outgoingCompressionType, + self.assertEqual(self.proto.outgoingCompressionType, 'none') - self.assertEquals(self.proto.incomingCompressionType, + self.assertEqual(self.proto.incomingCompressionType, 'none') ne = self.proto.nextEncryptions - self.assertEquals(ne.outCipType, 'aes256-ctr') - self.assertEquals(ne.inCipType, 'aes256-ctr') - self.assertEquals(ne.outMACType, 'hmac-sha1') - self.assertEquals(ne.inMACType, 'hmac-sha1') + self.assertEqual(ne.outCipType, 'aes256-ctr') + self.assertEqual(ne.inCipType, 'aes256-ctr') + self.assertEqual(ne.outMACType, 'hmac-sha1') + self.assertEqual(ne.inMACType, 'hmac-sha1') def verifyHostKey(self, pubKey, fingerprint): @@ -1548,8 +1548,8 @@ Mock version of SSHClientTransport.verifyHostKey. """ self.calledVerifyHostKey = True - self.assertEquals(pubKey, self.blob) - self.assertEquals(fingerprint.replace(':', ''), + self.assertEqual(pubKey, self.blob) + self.assertEqual(fingerprint.replace(':', ''), md5(pubKey).hexdigest()) return defer.succeed(True) @@ -1583,7 +1583,7 @@ self.proto.supportedKeyExchanges = [ 'diffie-hellman-group-exchange-sha1'] self.proto.dataReceived(self.transport.value()) - self.assertEquals(self.packets, [(transport.MSG_KEX_DH_GEX_REQUEST_OLD, + self.assertEqual(self.packets, [(transport.MSG_KEX_DH_GEX_REQUEST_OLD, '\x00\x00\x08\x00')]) @@ -1593,8 +1593,8 @@ """ self.proto.supportedKeyExchanges = ['diffie-hellman-group1-sha1'] self.proto.dataReceived(self.transport.value()) - self.assertEquals(common.MP(self.proto.x)[5:], '\x99' * 64) - self.assertEquals(self.packets, + self.assertEqual(common.MP(self.proto.x)[5:], '\x99' * 64) + self.assertEqual(self.packets, [(transport.MSG_KEXDH_INIT, self.proto.e)]) @@ -1628,8 +1628,8 @@ def _cbTestKEXDH_REPLY(value): self.assertIdentical(value, None) - self.assertEquals(self.calledVerifyHostKey, True) - self.assertEquals(self.proto.sessionID, exchangeHash) + self.assertEqual(self.calledVerifyHostKey, True) + self.assertEqual(self.proto.sessionID, exchangeHash) signature = self.privObj.sign(exchangeHash) @@ -1649,12 +1649,12 @@ self.test_KEXINIT_groupexchange() self.proto.ssh_KEX_DH_GEX_GROUP( '\x00\x00\x00\x01\x0f\x00\x00\x00\x01\x02') - self.assertEquals(self.proto.p, 15) - self.assertEquals(self.proto.g, 2) - self.assertEquals(common.MP(self.proto.x)[5:], '\x99' * 40) - self.assertEquals(self.proto.e, + self.assertEqual(self.proto.p, 15) + self.assertEqual(self.proto.g, 2) + self.assertEqual(common.MP(self.proto.x)[5:], '\x99' * 40) + self.assertEqual(self.proto.e, common.MP(pow(2, self.proto.x, 15))) - self.assertEquals(self.packets[1:], [(transport.MSG_KEX_DH_GEX_INIT, + self.assertEqual(self.packets[1:], [(transport.MSG_KEX_DH_GEX_INIT, self.proto.e)]) @@ -1678,8 +1678,8 @@ def _cbTestKEX_DH_GEX_REPLY(value): self.assertIdentical(value, None) - self.assertEquals(self.calledVerifyHostKey, True) - self.assertEquals(self.proto.sessionID, exchangeHash) + self.assertEqual(self.calledVerifyHostKey, True) + self.assertEqual(self.proto.sessionID, exchangeHash) signature = self.privObj.sign(exchangeHash) @@ -1697,12 +1697,12 @@ """ self.proto.nextEncryptions = MockCipher() self.simulateKeyExchange('AB', 'CD') - self.assertEquals(self.proto.sessionID, 'CD') + self.assertEqual(self.proto.sessionID, 'CD') self.simulateKeyExchange('AB', 'EF') - self.assertEquals(self.proto.sessionID, 'CD') - self.assertEquals(self.packets[-1], (transport.MSG_NEWKEYS, '')) + self.assertEqual(self.proto.sessionID, 'CD') + self.assertEqual(self.packets[-1], (transport.MSG_NEWKEYS, '')) newKeys = [self.proto._getKey(c, 'AB', 'EF') for c in 'ABCDEF'] - self.assertEquals(self.proto.nextEncryptions.keys, + self.assertEqual(self.proto.nextEncryptions.keys, (newKeys[0], newKeys[2], newKeys[1], newKeys[3], newKeys[4], newKeys[5])) @@ -1755,7 +1755,7 @@ Test that requesting a service sends a SERVICE_REQUEST packet. """ self.proto.requestService(MockService()) - self.assertEquals(self.packets, [(transport.MSG_SERVICE_REQUEST, + self.assertEqual(self.packets, [(transport.MSG_SERVICE_REQUEST, '\x00\x00\x00\x0bMockService')]) @@ -1812,10 +1812,10 @@ Test that the initializer sets up the SSHCiphers object. """ ciphers = transport.SSHCiphers('A', 'B', 'C', 'D') - self.assertEquals(ciphers.outCipType, 'A') - self.assertEquals(ciphers.inCipType, 'B') - self.assertEquals(ciphers.outMACType, 'C') - self.assertEquals(ciphers.inMACType, 'D') + self.assertEqual(ciphers.outCipType, 'A') + self.assertEqual(ciphers.inCipType, 'B') + self.assertEqual(ciphers.outMACType, 'C') + self.assertEqual(ciphers.inMACType, 'D') def test_getCipher(self): @@ -1843,12 +1843,12 @@ if macName == 'none': self.assertIdentical(mac, None) else: - self.assertEquals(mod[0], mac) - self.assertEquals(mod[1], + self.assertEqual(mod[0], mac) + self.assertEqual(mod[1], Crypto.Cipher.XOR.new('\x36').encrypt(key)) - self.assertEquals(mod[2], + self.assertEqual(mod[2], Crypto.Cipher.XOR.new('\x5c').encrypt(key)) - self.assertEquals(mod[3], len(mod[0]().digest())) + self.assertEqual(mod[3], len(mod[0]().digest())) def test_setKeysCiphers(self): @@ -1864,16 +1864,16 @@ bs = cip.block_size encCipher.setKeys(key, key, '', '', '', '') decCipher.setKeys('', '', key, key, '', '') - self.assertEquals(encCipher.encBlockSize, bs) - self.assertEquals(decCipher.decBlockSize, bs) + self.assertEqual(encCipher.encBlockSize, bs) + self.assertEqual(decCipher.decBlockSize, bs) enc = cip.encrypt(key[:bs]) enc2 = cip.encrypt(key[:bs]) if counter: self.failIfEquals(enc, enc2) - self.assertEquals(encCipher.encrypt(key[:bs]), enc) - self.assertEquals(encCipher.encrypt(key[:bs]), enc2) - self.assertEquals(decCipher.decrypt(enc), key[:bs]) - self.assertEquals(decCipher.decrypt(enc2), key[:bs]) + self.assertEqual(encCipher.encrypt(key[:bs]), enc) + self.assertEqual(encCipher.encrypt(key[:bs]), enc2) + self.assertEqual(decCipher.decrypt(enc), key[:bs]) + self.assertEqual(decCipher.decrypt(enc2), key[:bs]) def test_setKeysMACs(self): @@ -1890,7 +1890,7 @@ ds = mod().digest_size else: ds = 0 - self.assertEquals(inMac.verifyDigestSize, ds) + self.assertEqual(inMac.verifyDigestSize, ds) if mod: mod, i, o, ds = outMac._getMAC(macName, key) seqid = 0 @@ -1900,7 +1900,7 @@ mac = mod(o + mod(i + packet).digest()).digest() else: mac = '' - self.assertEquals(outMac.makeMAC(seqid, data), mac) + self.assertEqual(outMac.makeMAC(seqid, data), mac) self.assertTrue(inMac.verify(seqid, data, mac)) @@ -1921,8 +1921,8 @@ Test that the counter is initialized correctly. """ counter = transport._Counter('\x00' * 8 + '\xff' * 8, 8) - self.assertEquals(counter.blockSize, 8) - self.assertEquals(counter.count.tostring(), '\x00' * 8) + self.assertEqual(counter.blockSize, 8) + self.assertEqual(counter.count.tostring(), '\x00' * 8) def test_count(self): @@ -1930,11 +1930,11 @@ Test that the counter counts incrementally and wraps at the top. """ counter = transport._Counter('\x00', 1) - self.assertEquals(counter(), '\x01') - self.assertEquals(counter(), '\x02') + self.assertEqual(counter(), '\x01') + self.assertEqual(counter(), '\x02') [counter() for i in range(252)] - self.assertEquals(counter(), '\xff') - self.assertEquals(counter(), '\x00') + self.assertEqual(counter(), '\xff') + self.assertEqual(counter(), '\x00') @@ -1978,8 +1978,8 @@ server.supportedMACs[0], server.supportedKeyExchanges[0], server.supportedCompressions[0]]) - self.assertEquals(client.errors, []) - self.assertEquals(server.errors, [( + self.assertEqual(client.errors, []) + self.assertEqual(server.errors, [( transport.DISCONNECT_CONNECTION_LOST, "user closed connection")]) if server.supportedCiphers[0] == 'none': @@ -2069,7 +2069,7 @@ # The number of bytes requested will be the value of each byte # we return. return chr(bytes) * bytes - self.assertEquals( + self.assertEqual( transport._getRandomNumber(random, 32), 4 << 24 | 4 << 16 | 4 << 8 | 4) @@ -2093,7 +2093,7 @@ results = [chr(0), chr(1), chr(127)] def random(bytes): return results.pop(0) * bytes - self.assertEquals( + self.assertEqual( transport._generateX(random, 8), 127) @@ -2108,7 +2108,7 @@ results = [chr(255), chr(64)] def random(bytes): return results.pop(0) * bytes - self.assertEquals( + self.assertEqual( transport._generateX(random, 8), 64) @@ -2143,7 +2143,7 @@ "a mapping from strings to Key objects instead." % (qual(MockOldFactoryPublicKeys),), factory.__file__, sshFactory.startFactory) - self.assertEquals(sshFactory.publicKeys, MockFactory().getPublicKeys()) + self.assertEqual(sshFactory.publicKeys, MockFactory().getPublicKeys()) def test_getPrivateKeysWarning(self): @@ -2158,7 +2158,7 @@ " a mapping from strings to Key objects instead." % (qual(MockOldFactoryPrivateKeys),), factory.__file__, sshFactory.startFactory) - self.assertEquals(sshFactory.privateKeys, + self.assertEqual(sshFactory.privateKeys, MockFactory().getPrivateKeys()) @@ -2175,7 +2175,7 @@ "a mapping from strings to Key objects instead." % (qual(MockOldFactoryPublicKeys),), factory.__file__, sshFactory.startFactory) - self.assertEquals(sshFactory.publicKeys, MockFactory().getPublicKeys()) + self.assertEqual(sshFactory.publicKeys, MockFactory().getPublicKeys()) def test_privateKeysWarning(self): @@ -2192,5 +2192,5 @@ " a mapping from strings to Key objects instead." % (qual(MockOldFactoryPrivateKeys),), factory.__file__, sshFactory.startFactory) - self.assertEquals(sshFactory.privateKeys, + self.assertEqual(sshFactory.privateKeys, MockFactory().getPrivateKeys()) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_userauth.py twisted-conch-11.1.0/twisted/conch/test/test_userauth.py --- twisted-conch-11.0.0/twisted/conch/test/test_userauth.py 2011-02-14 04:45:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_userauth.py 2011-08-26 14:19:19.000000000 +0000 @@ -306,7 +306,7 @@ """ Check that the authentication has failed. """ - self.assertEquals(self.authServer.transport.packets[-1], + self.assertEqual(self.authServer.transport.packets[-1], (userauth.MSG_USERAUTH_FAILURE, NS('keyboard-interactive,password,publickey') + '\x00')) @@ -353,7 +353,7 @@ packet = NS('foo') + NS('none') + NS('password') + chr(0) + NS('bar') self.authServer.clock = task.Clock() d = self.authServer.ssh_USERAUTH_REQUEST(packet) - self.assertEquals(self.authServer.transport.packets, []) + self.assertEqual(self.authServer.transport.packets, []) self.authServer.clock.advance(2) return d.addCallback(self._checkFailed) @@ -372,7 +372,7 @@ packet += NS(signature) d = self.authServer.ssh_USERAUTH_REQUEST(packet) def check(ignored): - self.assertEquals(self.authServer.transport.packets, + self.assertEqual(self.authServer.transport.packets, [(userauth.MSG_USERAUTH_SUCCESS, '')]) return d.addCallback(check) @@ -413,7 +413,7 @@ + NS('ssh-rsa') + NS(blob)) d = self.authServer.ssh_USERAUTH_REQUEST(packet) def check(ignored): - self.assertEquals(self.authServer.transport.packets, + self.assertEqual(self.authServer.transport.packets, [(userauth.MSG_USERAUTH_PK_OK, NS('ssh-rsa') + NS(blob))]) return d.addCallback(check) @@ -454,7 +454,7 @@ d = self.authServer.ssh_USERAUTH_REQUEST(packet) self.authServer.ssh_USERAUTH_INFO_RESPONSE(response) def check(ignored): - self.assertEquals(self.authServer.transport.packets, + self.assertEqual(self.authServer.transport.packets, [(userauth.MSG_USERAUTH_INFO_REQUEST, (NS('') + NS('') + NS('') + '\x00\x00\x00\x02' + NS('Name: ') + '\x01' + NS('Password: ') + '\x00')), @@ -473,7 +473,7 @@ d = self.authServer.ssh_USERAUTH_REQUEST(packet) self.authServer.ssh_USERAUTH_INFO_RESPONSE(response) def check(ignored): - self.assertEquals(self.authServer.transport.packets[0], + self.assertEqual(self.authServer.transport.packets[0], (userauth.MSG_USERAUTH_INFO_REQUEST, (NS('') + NS('') + NS('') + '\x00\x00\x00\x02' + NS('Name: ') + '\x01' + NS('Password: ') + '\x00'))) @@ -515,9 +515,9 @@ + NS('') + NS('')) self.authServer.ssh_USERAUTH_REQUEST(packet) self.authServer.ssh_USERAUTH_REQUEST(packet) - self.assertEquals(self.authServer.transport.packets[-1][0], + self.assertEqual(self.authServer.transport.packets[-1][0], transport.MSG_DISCONNECT) - self.assertEquals(self.authServer.transport.packets[-1][1][3], + self.assertEqual(self.authServer.transport.packets[-1][1][3], chr(transport.DISCONNECT_PROTOCOL_ERROR)) @@ -536,7 +536,7 @@ server.serviceStarted() server.serviceStopped() server.supportedAuthentications.sort() # give a consistent order - self.assertEquals(server.supportedAuthentications, + self.assertEqual(server.supportedAuthentications, ['keyboard-interactive', 'password', 'publickey']) @@ -603,7 +603,7 @@ clearAuthServer.transport.isEncrypted = lambda x: False clearAuthServer.serviceStarted() clearAuthServer.serviceStopped() - self.assertEquals(clearAuthServer.supportedAuthentications, + self.assertEqual(clearAuthServer.supportedAuthentications, ['publickey']) # only encrypt incoming (the direction the password is sent) @@ -612,7 +612,7 @@ halfAuthServer.transport.isEncrypted = lambda x: x == 'in' halfAuthServer.serviceStarted() halfAuthServer.serviceStopped() - self.assertEquals(clearAuthServer.supportedAuthentications, + self.assertEqual(clearAuthServer.supportedAuthentications, ['publickey']) @@ -626,7 +626,7 @@ timeoutAuthServer.serviceStarted() timeoutAuthServer.clock.advance(11 * 60 * 60) timeoutAuthServer.serviceStopped() - self.assertEquals(timeoutAuthServer.transport.packets, + self.assertEqual(timeoutAuthServer.transport.packets, [(transport.MSG_DISCONNECT, '\x00' * 3 + chr(transport.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE) + @@ -644,7 +644,7 @@ timeoutAuthServer.serviceStarted() timeoutAuthServer.serviceStopped() timeoutAuthServer.clock.advance(11 * 60 * 60) - self.assertEquals(timeoutAuthServer.transport.packets, []) + self.assertEqual(timeoutAuthServer.transport.packets, []) self.assertFalse(timeoutAuthServer.transport.lostConnection) @@ -659,7 +659,7 @@ d = self.authServer.ssh_USERAUTH_REQUEST(packet) self.authServer.clock.advance(2) def check(ignored): - self.assertEquals(self.authServer.transport.packets[-1], + self.assertEqual(self.authServer.transport.packets[-1], (transport.MSG_DISCONNECT, '\x00' * 3 + chr(transport.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE) + @@ -743,9 +743,9 @@ """ Test that client is initialized properly. """ - self.assertEquals(self.authClient.user, 'foo') - self.assertEquals(self.authClient.instance.name, 'nancy') - self.assertEquals(self.authClient.transport.packets, + self.assertEqual(self.authClient.user, 'foo') + self.assertEqual(self.authClient.instance.name, 'nancy') + self.assertEqual(self.authClient.transport.packets, [(userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('none'))]) @@ -759,7 +759,7 @@ instance[0] = service self.authClient.transport.setService = stubSetService self.authClient.ssh_USERAUTH_SUCCESS('') - self.assertEquals(instance[0], self.authClient.instance) + self.assertEqual(instance[0], self.authClient.instance) def test_publickey(self): @@ -767,7 +767,7 @@ Test that the client can authenticate with a public key. """ self.authClient.ssh_USERAUTH_FAILURE(NS('publickey') + '\x00') - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('publickey') + '\x00' + NS('ssh-dss') + NS(keys.Key.fromString( @@ -775,19 +775,19 @@ # that key isn't good self.authClient.ssh_USERAUTH_FAILURE(NS('publickey') + '\x00') blob = NS(keys.Key.fromString(keydata.publicRSA_openssh).blob()) - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, (NS('foo') + NS('nancy') + NS('publickey') + '\x00'+ NS('ssh-rsa') + blob))) self.authClient.ssh_USERAUTH_PK_OK(NS('ssh-rsa') + NS(keys.Key.fromString(keydata.publicRSA_openssh).blob())) sigData = (NS(self.authClient.transport.sessionID) + chr(userauth.MSG_USERAUTH_REQUEST) + NS('foo') - + NS('nancy') + NS('publickey') + '\xff' + NS('ssh-rsa') + + NS('nancy') + NS('publickey') + '\x01' + NS('ssh-rsa') + blob) obj = keys.Key.fromString(keydata.privateRSA_openssh) - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') - + NS('publickey') + '\xff' + NS('ssh-rsa') + blob + + NS('publickey') + '\x01' + NS('ssh-rsa') + blob + NS(obj.sign(sigData)))) @@ -806,7 +806,7 @@ authClient.tryAuth('publickey') authClient.transport.packets = [] self.assertIdentical(authClient.ssh_USERAUTH_PK_OK(''), None) - self.assertEquals(authClient.transport.packets, [ + self.assertEqual(authClient.transport.packets, [ (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('none'))]) @@ -826,7 +826,7 @@ "SSHUserAuthClient.getPublicKey() is deprecated since " "Twisted 9.0. Return a keys.Key() instead.", userauth.__file__, oldAuth.tryAuth, 'publickey') - self.assertEquals(oldAuth.transport.packets, [ + self.assertEqual(oldAuth.transport.packets, [ (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('publickey') + '\x00' + NS('ssh-rsa') + NS(keys.Key.fromString(keydata.publicRSA_openssh).blob()))]) @@ -845,7 +845,7 @@ "Return a keys.Key() instead.", userauth.__file__, oldAuth.signData, None, 'data') def _checkSignedData(sig): - self.assertEquals(sig, + self.assertEqual(sig, keys.Key.fromString(keydata.privateRSA_openssh).sign( 'data')) d.addCallback(_checkSignedData) @@ -869,11 +869,11 @@ includes changing the password. """ self.authClient.ssh_USERAUTH_FAILURE(NS('password') + '\x00') - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('password') + '\x00' + NS('foo'))) self.authClient.ssh_USERAUTH_PK_OK(NS('') + NS('')) - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('password') + '\xff' + NS('foo') * 2)) @@ -893,12 +893,12 @@ """ self.authClient.ssh_USERAUTH_FAILURE(NS('keyboard-interactive') + '\x00') - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('keyboard-interactive') + NS('')*2)) self.authClient.ssh_USERAUTH_PK_OK(NS('')*3 + '\x00\x00\x00\x02' + NS('Name: ') + '\xff' + NS('Password: ') + '\x00') - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_INFO_RESPONSE, '\x00\x00\x00\x02' + NS('foo')*2)) @@ -912,7 +912,7 @@ self.authClient.lastAuth = 'unknown' self.authClient.transport.packets = [] self.authClient.ssh_USERAUTH_PK_OK('') - self.assertEquals(self.authClient.transport.packets, + self.assertEqual(self.authClient.transport.packets, [(userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('none'))]) @@ -936,12 +936,12 @@ self.authClient.ssh_USERAUTH_FAILURE(NS('anothermethod,password') + '\x00') # should send password packet - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('password') + '\x00' + NS('foo'))) self.authClient.ssh_USERAUTH_FAILURE( NS('firstmethod,anothermethod,password') + '\xff') - self.assertEquals(self.authClient.transport.packets[-2:], + self.assertEqual(self.authClient.transport.packets[-2:], [(255, 'here is data'), (254, 'other data')]) @@ -953,7 +953,7 @@ """ self.authClient.ssh_USERAUTH_FAILURE(NS('password') + '\x00') self.authClient.ssh_USERAUTH_FAILURE(NS('password') + '\xff') - self.assertEquals(self.authClient.transport.packets[-1], + self.assertEqual(self.authClient.transport.packets[-1], (transport.MSG_DISCONNECT, '\x00\x00\x00\x0e' + NS('no more authentication methods available') + '\x00\x00\x00\x00')) @@ -966,7 +966,7 @@ """ self.authClient.transport.packets = [] self.authClient._ebAuth(None) - self.assertEquals(self.authClient.transport.packets, + self.assertEqual(self.authClient.transport.packets, [(userauth.MSG_USERAUTH_REQUEST, NS('foo') + NS('nancy') + NS('none'))]) @@ -1058,5 +1058,5 @@ client.serviceStarted() def check(ignored): - self.assertEquals(server.transport.service.name, 'TestService') + self.assertEqual(server.transport.service.name, 'TestService') return d.addCallback(check) diff -Nru twisted-conch-11.0.0/twisted/conch/test/test_window.py twisted-conch-11.1.0/twisted/conch/test/test_window.py --- twisted-conch-11.0.0/twisted/conch/test/test_window.py 2007-01-22 22:01:11.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/test/test_window.py 2011-05-15 14:25:06.000000000 +0000 @@ -5,7 +5,7 @@ from twisted.trial.unittest import TestCase -from twisted.conch.insults.window import TopWindow +from twisted.conch.insults.window import TopWindow, ScrolledArea, TextOutput class TopWindowTests(TestCase): @@ -47,3 +47,21 @@ root.repaint() self.assertEqual(len(paints), 1) self.assertEqual(len(scheduled), 1) + + + +class ScrolledAreaTests(TestCase): + """ + Tests for L{ScrolledArea}, a widget which creates a viewport containing + another widget and can reposition that viewport using scrollbars. + """ + def test_parent(self): + """ + The parent of the widget passed to L{ScrolledArea} is set to a new + L{Viewport} created by the L{ScrolledArea} which itself has the + L{ScrolledArea} instance as its parent. + """ + widget = TextOutput() + scrolled = ScrolledArea(widget) + self.assertIdentical(widget.parent, scrolled._viewport) + self.assertIdentical(scrolled._viewport.parent, scrolled) diff -Nru twisted-conch-11.0.0/twisted/conch/_version.py twisted-conch-11.1.0/twisted/conch/_version.py --- twisted-conch-11.0.0/twisted/conch/_version.py 2011-04-02 01:10:15.000000000 +0000 +++ twisted-conch-11.1.0/twisted/conch/_version.py 2011-11-15 16:39:18.000000000 +0000 @@ -1,3 +1,3 @@ # This is an auto-generated file. Do not edit it. from twisted.python import versions -version = versions.Version('twisted.conch', 11, 0, 0) +version = versions.Version('twisted.conch', 11, 1, 0)