From db968900d9c981df82dfce9eec2af4a4ce38b08e Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 23 Dec 2016 13:41:00 -0500 Subject: [PATCH] test_server: improve coverage --- src/wormhole/test/test_server.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index 2d67ab2..cf1a5f7 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -1334,7 +1334,7 @@ class Transit(ServerBase, unittest.TestCase): a1.transport.loseConnection() @defer.inlineCallbacks - def test_impatience(self): + def test_impatience_old(self): ep = clientFromString(reactor, self.transit) a1 = yield connectProtocol(ep, Accumulator()) @@ -1347,3 +1347,20 @@ class Transit(ServerBase, unittest.TestCase): self.assertEqual(a1.data, exp) a1.transport.loseConnection() + + @defer.inlineCallbacks + def test_impatience_new(self): + ep = clientFromString(reactor, self.transit) + a1 = yield connectProtocol(ep, Accumulator()) + + token1 = b"\x00"*32 + side1 = b"\x01"*8 + # sending too many bytes is impatience. + a1.transport.write(b"please relay " + hexlify(token1) + + b" for side " + hexlify(side1) + b"\nNOWNOWNOW") + + exp = b"impatient\n" + yield a1.waitForBytes(len(exp)) + self.assertEqual(a1.data, exp) + + a1.transport.loseConnection()