test_server: improve coverage
This commit is contained in:
parent
b8313b4595
commit
db968900d9
|
@ -1334,7 +1334,7 @@ class Transit(ServerBase, unittest.TestCase):
|
||||||
a1.transport.loseConnection()
|
a1.transport.loseConnection()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_impatience(self):
|
def test_impatience_old(self):
|
||||||
ep = clientFromString(reactor, self.transit)
|
ep = clientFromString(reactor, self.transit)
|
||||||
a1 = yield connectProtocol(ep, Accumulator())
|
a1 = yield connectProtocol(ep, Accumulator())
|
||||||
|
|
||||||
|
@ -1347,3 +1347,20 @@ class Transit(ServerBase, unittest.TestCase):
|
||||||
self.assertEqual(a1.data, exp)
|
self.assertEqual(a1.data, exp)
|
||||||
|
|
||||||
a1.transport.loseConnection()
|
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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user