mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
Use the port assigner in test_introducer
This commit is contained in:
parent
4265cc8afd
commit
f5e287d3e9
@ -1,15 +1,24 @@
|
||||
from os.path import join
|
||||
from twisted.trial import unittest
|
||||
from twisted.internet import reactor
|
||||
from foolscap.api import fireEventually, flushEventualQueue
|
||||
from twisted.internet import defer
|
||||
from allmydata.introducer import create_introducer
|
||||
from allmydata import node
|
||||
from .common import FAVICON_MARKUP
|
||||
from .common import (
|
||||
FAVICON_MARKUP,
|
||||
)
|
||||
from ..common import (
|
||||
SameProcessStreamEndpointAssigner,
|
||||
)
|
||||
from ..common_web import do_http
|
||||
|
||||
class IntroducerWeb(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.node = None
|
||||
self.port_assigner = SameProcessStreamEndpointAssigner()
|
||||
self.port_assigner.setUp()
|
||||
self.addCleanup(self.port_assigner.tearDown)
|
||||
|
||||
def tearDown(self):
|
||||
d = defer.succeed(None)
|
||||
@ -22,11 +31,12 @@ class IntroducerWeb(unittest.TestCase):
|
||||
def test_welcome(self):
|
||||
basedir = self.mktemp()
|
||||
node.create_node_dir(basedir, "testing")
|
||||
_, port_endpoint = self.port_assigner.assign(reactor)
|
||||
with open(join(basedir, "tahoe.cfg"), "w") as f:
|
||||
f.write(
|
||||
"[node]\n"
|
||||
"tub.location = 127.0.0.1:1\n"
|
||||
"web.port = tcp:0\n"
|
||||
"tub.location = 127.0.0.1:1\n" +
|
||||
"web.port = {}\n".format(port_endpoint)
|
||||
)
|
||||
|
||||
self.node = yield create_introducer(basedir)
|
||||
|
Loading…
Reference in New Issue
Block a user