def testDataReceivedBigFile(self): self.assertNotEqual(self.protocol,None) for i in range(0,100): unity.wrapBlocking(self.protocol.dataReceived,"This is a test line" + str(i) + "\n") threads.blockingCallFromThread(reactor,self.protocol.transport.loseConnection) unity.wait(0.1) f = open("testing.txt","r") self.assertNotEqual(f,None) for i in range(0,100): l = f.readline() self.assertEqual(l,"This is a test line" + str(i) +"\n") f.close()
def testName(self): self.assertEqual(1,1) unity.wrapBlocking(self.protocol.transport.write,"Hello!") pass
def tearDown(self): # The waiting here is important to ensure there is time for all tests # to finish. unity.wait(1) unity.wrapBlocking(self.protocol.transport.loseConnection) pass