test_full: finish test, although it still fails

This commit is contained in:
Brian Warner 2019-02-10 16:59:07 -08:00
parent 53ad951c11
commit 7f90999775

View File

@ -1,7 +1,7 @@
from __future__ import print_function, absolute_import, unicode_literals
import wormhole
from twisted.internet import reactor
from twisted.internet.defer import Deferred, inlineCallbacks
from twisted.internet.defer import Deferred, inlineCallbacks, gatherResults
from twisted.internet.protocol import Protocol, Factory
from twisted.trial import unittest
@ -11,6 +11,9 @@ from ..._dilation._noise import NoiseConnection
APPID = u"lothar.com/dilate-test"
def doBoth(d1, d2):
return gatherResults([d1, d2], True)
class L(Protocol):
def connectionMade(self):
print("got connection")
@ -32,6 +35,7 @@ class Full(ServerBase, unittest.TestCase):
@inlineCallbacks
def test_full(self):
raise unittest.SkipTest("not ready yet")
eq = EventualQueue(reactor)
w1 = wormhole.create(APPID, self.relayurl, reactor, _enable_dilate=True)
w2 = wormhole.create(APPID, self.relayurl, reactor, _enable_dilate=True)
@ -39,14 +43,13 @@ class Full(ServerBase, unittest.TestCase):
code = yield w1.get_code()
print("code is: {}".format(code))
w2.set_code(code)
yield w1.get_verifier()
yield w2.get_verifier()
yield doBoth(w1.get_verifier(), w2.get_verifier())
print("connected")
eps1 = yield w1.dilate()
eps1_d = w1.dilate()
eps2_d = w2.dilate()
(eps1, eps2) = yield doBoth(eps1_d, eps2_d)
(control_ep1, connect_ep1, listen_ep1) = eps1
eps2 = yield w2.dilate()
(control_ep2, connect_ep2, listen_ep2) = eps2
print("w.dilate ready")
@ -71,5 +74,9 @@ class Full(ServerBase, unittest.TestCase):
yield w1.close()
yield w2.close()
# TODO: this shouldn't be necessary. Also, it doesn't help.
d = Deferred()
reactor.callLater(1.0, d.callback, None)
yield d
test_full.timeout = 10