Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread Anshul Singhle
> ClientCreator.connectTCP returns a Deferred that fires with a Protocol > instance (in this case, a SimpleTransport instance), which you are then > comparing with a string in got_data(). This fails, as one would expect. > > So then how do i get the protocol to run? and how do i get the data receiv

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread Itamar Turner-Trauring
On Fri, 2011-07-01 at 19:11 +0530, Anshul Singhle wrote: > def test_1(self): > def got_data(data): > self.assertEquals(data,"a") > d = protocol.ClientCreator(reactor, > SimpleTransport).connectTCP('localhost', self.server.getHost().port) > d.addCallback

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread Anshul Singhle
Ok, here goes : The test code : from twisted.trial import unittest from twisted.internet import defer, protocol, reactor class TestAccountStatus(unittest.TestCase): def setUp(self): ssh_server = Server() self.server = reactor.listenTCP(ssh_server.port,

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread exarkun
On 12:59 pm, anshul.sing...@gmail.com wrote: >I understand that. The problem I'm facing is that unless I write >"reactor.run()" my client isn't starting up. From what I understood in >the >trial documentation, I should simply call the connectTCP method and >then >return a deferred. However, if I

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread Anshul Singhle
> Is that the Python standard library's unittest.TestCase, or > twisted.trial.unittest.TestCase? As Jean-Paul says, Twisted's TestCase > should automatically handle the reactor for you; that's why it exists. > :) > It is Twisted's TestCase( twisted.trial.unittest.TestCase) _

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread Anshul Singhle
I understand that. The problem I'm facing is that unless I write "reactor.run()" my client isn't starting up. From what I understood in the trial documentation, I should simply call the connectTCP method and then return a deferred. However, if I do that, the client isn't starting. I'll post some of

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread Tim Allen
On Fri, Jul 01, 2011 at 05:44:31PM +0530, Anshul Singhle wrote: > What I'm trying is : > class TestAccountStatus(unittest.TestCase): Is that the Python standard library's unittest.TestCase, or twisted.trial.unittest.TestCase? As Jean-Paul says, Twisted's TestCase should automatically handle the re

Re: [Twisted-Python] Conch Testing server and client

2011-07-01 Thread exarkun
On 12:14 pm, anshul.sing...@gmail.com wrote: >Hi, >I have to write tests for a custom conch server. My approach is to make >a >test client and then connect it to my server in my testcase. I have >been >able to create a client that can interface with my server, but i'm not >able >to do it from wi

[Twisted-Python] Conch Testing server and client

2011-07-01 Thread Anshul Singhle
Hi, I have to write tests for a custom conch server. My approach is to make a test client and then connect it to my server in my testcase. I have been able to create a client that can interface with my server, but i'm not able to do it from within the test case. What I'm trying is : class TestAccou