Ok, here goes :<br>The test code :<br><br>from twisted.trial import unittest<br>from twisted.internet import defer, protocol, reactor<br>class TestAccountStatus(unittest.TestCase):<br>     def setUp(self):<br>         ssh_server = Server()<br>
         self.server = reactor.listenTCP(ssh_server.port, <br>                      ssh_server.application(), <br>                      interface=ssh_server.interface)<br>         return self.server<br>     def tearDown(self):<br>
         server, self.server = self.server,None<br>         return server.stopListening()<br>     def test_1(self):<br>         def got_data(data):<br>             self.assertEquals(data,&quot;a&quot;)<br>         d = protocol.ClientCreator(reactor, SimpleTransport).connectTCP(&#39;localhost&#39;, self.server.getHost().port)<br>
         d.addCallback(got_data)<br>         return d<br><br>The client code :<br>from twisted.conch.ssh import transport, userauth, connection, common, keys, channel<br>from twisted.internet import defer, protocol, reactor<br>
class SimpleTransport(transport.SSHClientTransport):<br>    def verifyHostKey(self, hostKey, fingerprint):<br>        print &#39;host key fingerprint: %s&#39; % fingerprint<br>        return defer.succeed(1) <br><br>    def connectionSecure(self):<br>
        self.requestService(<br>            SimpleUserAuth(&#39;webchick&#39;,<br>                SimpleConnection()))<br><br>class SimpleUserAuth(userauth.SSHUserAuthClient):<br>    def getPassword(self):<br>        print &quot;Get Password called&quot;<br>
        return defer.succeed(&quot;Thai1mil3ahb&quot;)<br><br>When I run the test I expect :<br>  tests<br>  TestAccountStatus<br>    test_1 ... Get Password called <br><br>followed by some errors , but atleast this much should be printed if the client code is being called properly.<br>
Instead I get:<br><br>[FAIL]: tests.TestAccountStatus.test_1<br><br>Traceback (most recent call last):<br>  File &quot;tests.py&quot;, line 92, in got_data<br>    self.assertEquals(data,&quot;a&quot;)<br>twisted.trial.unittest.FailTest: not equal:<br>
a = &lt;tests.SimpleTransport instance at 0x1024aa128&gt;<br>b = &#39;a&#39;<br><br>Instead of running the client the deferred is just returning an instance of the Client Transport used by me  (SimpleTransport). Any ideas why this is happening? Is this becuse I&#39;m not using a ClientFactory or am I using the deferred all wrong? <br>