def testFileTransfer(self): auth = 1234 sender = msn.FileSend(self.input) sender.auth = auth sender.fileSize = 7000 client = msn.FileReceive(auth, "*****@*****.**", self.output) client.fileSize = 7000 loopback.loopback(sender, client) self.failUnless((client.completed and sender.completed), msg="send failed to complete") self.failUnless((self.input.getvalue() == self.output.getvalue()), msg="saved file does not match original")
def test_fileTransfer(self): """ Test L{FileSend} against L{FileReceive} using a loopback transport. """ auth = 1234 sender = msn.FileSend(StringIO.StringIO(self.input)) sender.auth = auth sender.fileSize = 7000 client = msn.FileReceive(auth, "*****@*****.**", self.output) client.fileSize = 7000 def check(ignored): self.assertTrue( client.completed and sender.completed, msg="send failed to complete") self.assertEqual( self.input, self.output.getvalue(), msg="saved file does not match original") d = loopback.loopbackAsync(sender, client) d.addCallback(check) return d