mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 02:01:31 +00:00
rename introducer_factory parameter to be private
This commit is contained in:
parent
8516459fa3
commit
251eda0b80
@ -247,7 +247,7 @@ def create_client(basedir=u".", _client_factory=None):
|
||||
return defer.fail()
|
||||
|
||||
|
||||
def create_client_from_config(config, _client_factory=None, introducer_factory=None):
|
||||
def create_client_from_config(config, _client_factory=None, _introducer_factory=None):
|
||||
"""
|
||||
Creates a new client instance (a subclass of Node). Most code
|
||||
should probably use `create_client` instead.
|
||||
@ -260,7 +260,7 @@ def create_client_from_config(config, _client_factory=None, introducer_factory=N
|
||||
:param _client_factory: for testing; the class to instantiate
|
||||
instead of _Client
|
||||
|
||||
:param introducer_factory: for testing; the class to instantiate instead
|
||||
:param _introducer_factory: for testing; the class to instantiate instead
|
||||
of IntroducerClient
|
||||
"""
|
||||
try:
|
||||
@ -279,7 +279,7 @@ def create_client_from_config(config, _client_factory=None, introducer_factory=N
|
||||
)
|
||||
control_tub = node.create_control_tub()
|
||||
|
||||
introducer_clients = create_introducer_clients(config, main_tub, introducer_factory)
|
||||
introducer_clients = create_introducer_clients(config, main_tub, _introducer_factory)
|
||||
storage_broker = create_storage_farm_broker(
|
||||
config, default_connection_handlers, foolscap_connection_handlers,
|
||||
tub_options, introducer_clients
|
||||
@ -323,17 +323,17 @@ def _sequencer(config):
|
||||
return seqnum, nonce
|
||||
|
||||
|
||||
def create_introducer_clients(config, main_tub, introducer_factory=None):
|
||||
def create_introducer_clients(config, main_tub, _introducer_factory=None):
|
||||
"""
|
||||
Read, validate and parse any 'introducers.yaml' configuration.
|
||||
|
||||
:param introducer_factory: for testing; the class to instantiate instead
|
||||
:param _introducer_factory: for testing; the class to instantiate instead
|
||||
of IntroducerClient
|
||||
|
||||
:returns: a list of IntroducerClient instances
|
||||
"""
|
||||
if introducer_factory is None:
|
||||
introducer_factory = IntroducerClient
|
||||
if _introducer_factory is None:
|
||||
_introducer_factory = IntroducerClient
|
||||
|
||||
# we return this list
|
||||
introducer_clients = []
|
||||
@ -380,7 +380,7 @@ def create_introducer_clients(config, main_tub, introducer_factory=None):
|
||||
|
||||
for petname, introducer in introducers.items():
|
||||
introducer_cache_filepath = FilePath(config.get_private_path("introducer_{}_cache.yaml".format(petname)))
|
||||
ic = introducer_factory(
|
||||
ic = _introducer_factory(
|
||||
main_tub,
|
||||
introducer['furl'].encode("ascii"),
|
||||
config.nickname,
|
||||
|
@ -1139,7 +1139,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
self.get_config(storage_enabled=False),
|
||||
)
|
||||
self.assertThat(
|
||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
||||
client.create_client_from_config(
|
||||
config,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
),
|
||||
succeeded(AfterPreprocessing(
|
||||
get_published_announcements,
|
||||
Equals([]),
|
||||
@ -1159,7 +1162,7 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
)
|
||||
client_deferred = client.create_client_from_config(
|
||||
config,
|
||||
introducer_factory=MemoryIntroducerClient,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
)
|
||||
self.assertThat(
|
||||
client_deferred,
|
||||
@ -1197,7 +1200,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
),
|
||||
)
|
||||
self.assertThat(
|
||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
||||
client.create_client_from_config(
|
||||
config,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
),
|
||||
succeeded(AfterPreprocessing(
|
||||
get_published_announcements,
|
||||
MatchesListwise([
|
||||
@ -1234,7 +1240,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
),
|
||||
)
|
||||
self.assertThat(
|
||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
||||
client.create_client_from_config(
|
||||
config,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
),
|
||||
succeeded(AfterPreprocessing(
|
||||
get_published_announcements,
|
||||
MatchesListwise([
|
||||
@ -1276,11 +1285,11 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
)
|
||||
node_a = client.create_client_from_config(
|
||||
config,
|
||||
introducer_factory=MemoryIntroducerClient,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
)
|
||||
node_b = client.create_client_from_config(
|
||||
config,
|
||||
introducer_factory=MemoryIntroducerClient,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
)
|
||||
|
||||
self.assertThat(
|
||||
@ -1307,7 +1316,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
),
|
||||
)
|
||||
self.assertThat(
|
||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
||||
client.create_client_from_config(
|
||||
config,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
),
|
||||
succeeded(AfterPreprocessing(
|
||||
get_published_announcements,
|
||||
MatchesListwise([
|
||||
@ -1344,6 +1356,9 @@ introducer.furl = pb://abcde@nowhere/fake
|
||||
),
|
||||
)
|
||||
self.assertThat(
|
||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
||||
client.create_client_from_config(
|
||||
config,
|
||||
_introducer_factory=MemoryIntroducerClient,
|
||||
),
|
||||
failed(Always()),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user