Keep missing configuration tests passing; Always use mocked registry source.

pull/1759/head
Kieran Prasch 2020-03-05 10:02:20 -08:00
parent cf1ca2093f
commit eb32902704
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
4 changed files with 7 additions and 7 deletions

View File

@ -72,7 +72,7 @@ class Web3Client:
ALT_PARITY = 'Parity-Ethereum'
GANACHE = 'EthereumJS TestRPC'
ETHEREUM_TESTER = 'EthereumTester' # (PyEVM)
SYNC_TIMEOUT_DURATION = 60 # seconds to wait for various blockchain syncing endeavors
SYNC_TIMEOUT_DURATION = 60 # seconds to wait for various blockchain syncing endeavors
PEERING_TIMEOUT = 30
SYNC_SLEEP_DURATION = 5

View File

@ -666,7 +666,8 @@ def select_config_file(emitter,
secondary_config_files = glob.glob(glob_pattern)
config_files = [*default_config_file, *secondary_config_files]
if not config_files:
emitter.message(f"No {config_class._NAME} configurations found. run 'nucypher {config_class._NAME} init' then try again.", color='red')
emitter.message(f"No {config_class._NAME.capitalize()} configurations found. "
f"run 'nucypher {config_class._NAME} init' then try again.", color='red')
raise click.Abort()
checksum_address = checksum_address or os.environ.get(NUCYPHER_ENVVAR_WORKER_ADDRESS, None) # TODO: Deprecate worker_address in favor of checksum_address

View File

@ -40,12 +40,11 @@ from nucypher.utilities.sandbox.constants import (
from nucypher.utilities.sandbox.ursula import start_pytest_ursula_services
@mock.patch('nucypher.config.characters.UrsulaConfiguration.default_filepath', return_value='/non/existent/file')
@mock.patch('glob.glob', return_value=list())
def test_missing_configuration_file(default_filepath_mock, click_runner):
cmd_args = ('ursula', 'run')
cmd_args = ('ursula', 'run', '--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(nucypher_cli, cmd_args, catch_exceptions=False)
assert result.exit_code != 0
assert default_filepath_mock.called
assert "No Ursula configurations found. run 'nucypher ursula init' then try again." in result.output

View File

@ -402,7 +402,7 @@ def federated_ursulas(ursula_federated_test_config):
def token_economics(testerchain):
# Get current blocktime
blockchain = BlockchainInterfaceFactory.get_interface()
blockchain = BlockchainInterfaceFactory.get_interface(provider_uri=testerchain.provider_uri)
now = blockchain.w3.eth.getBlock(block_identifier='latest').timestamp
# Calculate instant start time
@ -568,7 +568,7 @@ def _make_agency(testerchain, test_registry, token_economics):
return token_agent, staking_agent, policy_agent
@pytest.fixture(scope='module')
@pytest.fixture(scope='module', autouse=True)
def test_registry_source_manager(testerchain, test_registry):
class MockRegistrySource(CanonicalRegistrySource):