Getting --lonely through each Character where it's used.

pull/2140/head
jMyles 2020-06-23 02:27:24 -07:00
parent 65607953dc
commit 61b87f93bf
4 changed files with 25 additions and 14 deletions

View File

@ -52,7 +52,8 @@ from nucypher.cli.options import (
option_provider_uri,
option_registry_filepath,
option_signer_uri,
option_teacher_uri, option_lonely
option_teacher_uri,
option_lonely
)
from nucypher.cli.painting.help import paint_new_installation_help
from nucypher.cli.processes import get_geth_provider_process

View File

@ -47,7 +47,8 @@ from nucypher.cli.options import (
option_provider_uri,
option_registry_filepath,
option_signer_uri,
option_teacher_uri
option_teacher_uri,
option_lonely
)
from nucypher.cli.painting.help import paint_new_installation_help
from nucypher.cli.utils import make_cli_character, setup_emitter
@ -71,7 +72,9 @@ class BobConfigOptions:
middleware: RestMiddleware,
federated_only: bool,
gas_strategy: str,
signer_uri: str):
signer_uri: str,
lonely: bool,
):
self.provider_uri = provider_uri
self.signer_uri = signer_uri
@ -83,6 +86,7 @@ class BobConfigOptions:
self.dev = dev
self.middleware = middleware
self.federated_only = federated_only
self.lonely = lonely
def create_config(self, emitter: StdoutEmitter, config_file: str) -> BobConfiguration:
if self.dev:
@ -158,7 +162,8 @@ group_config_options = group_options(
discovery_port=option_discovery_port(),
dev=option_dev,
middleware=option_middleware,
federated_only=option_federated_only
federated_only=option_federated_only,
lonely=option_lonely,
)
@ -177,7 +182,8 @@ class BobCharacterOptions:
emitter=emitter,
unlock_keyring=not self.config_options.dev,
teacher_uri=self.teacher_uri,
min_stake=self.min_stake)
min_stake=self.min_stake,
lonely=self.config_options.lonely)
group_character_options = group_options(

View File

@ -58,7 +58,8 @@ from nucypher.cli.options import (
option_provider_uri,
option_registry_filepath,
option_signer_uri,
option_teacher_uri
option_teacher_uri,
option_lonely
)
from nucypher.cli.painting.help import paint_new_installation_help
from nucypher.cli.painting.transactions import paint_receipt_summary
@ -94,7 +95,9 @@ class UrsulaConfigOptions:
light,
gas_strategy,
signer_uri,
availability_check):
availability_check,
lonely: bool
):
if federated_only:
if geth:
@ -125,6 +128,7 @@ class UrsulaConfigOptions:
self.light = light
self.gas_strategy = gas_strategy
self.availability_check = availability_check
self.lonely = lonely
def create_config(self, emitter, config_file):
if self.dev:
@ -246,7 +250,8 @@ group_config_options = group_options(
poa=option_poa,
light=option_light,
dev=option_dev,
availability_check=click.option('--availability-check/--disable-availability-check', help="Enable or disable self-health checks while running", is_flag=True, default=None)
availability_check=click.option('--availability-check/--disable-availability-check', help="Enable or disable self-health checks while running", is_flag=True, default=None),
lonely=option_lonely,
)
@ -254,9 +259,8 @@ class UrsulaCharacterOptions:
__option_name__ = 'character_options'
def __init__(self, config_options: UrsulaConfigOptions, lonely, teacher_uri, min_stake):
def __init__(self, config_options: UrsulaConfigOptions, teacher_uri, min_stake):
self.config_options = config_options
self.lonely = lonely
self.teacher_uri = teacher_uri
self.min_stake = min_stake
@ -279,9 +283,9 @@ class UrsulaCharacterOptions:
min_stake=self.min_stake,
teacher_uri=self.teacher_uri,
unlock_keyring=not self.config_options.dev,
lonely=self.lonely,
lonely=self.config_options.lonely,
client_password=client_password,
load_preferred_teachers=load_seednodes and not self.lonely,
# load_preferred_teachers=load_seednodes and not self.lonely,
start_learning_now=load_seednodes)
return ursula_config, URSULA

View File

@ -88,7 +88,7 @@ def test_initialize_bob_with_custom_configuration_root(custom_filepath, click_ru
def test_bob_control_starts_with_preexisting_configuration(click_runner, custom_filepath):
custom_config_filepath = os.path.join(custom_filepath, BobConfiguration.generate_filename())
init_args = ('bob', 'run', '--dry-run', '--config-file', custom_config_filepath)
init_args = ('bob', 'run', '--dry-run', '--lonely', '--config-file', custom_config_filepath)
result = click_runner.invoke(nucypher_cli, init_args, input=FAKE_PASSWORD_CONFIRMED)
assert result.exit_code == 0, result.exception
assert "Bob Verifying Key" in result.output
@ -107,7 +107,7 @@ def test_bob_view_with_preexisting_configuration(click_runner, custom_filepath):
def test_bob_public_keys(click_runner):
derive_key_args = ('bob', 'public-keys', '--dev')
derive_key_args = ('bob', 'public-keys', '--lonely', '--dev')
result = click_runner.invoke(nucypher_cli, derive_key_args, catch_exceptions=False)
assert result.exit_code == 0
assert "bob_encrypting_key" in result.output