Beispiel #1
0
def test_new_stakeholder(click_runner,
                         custom_filepath,
                         mock_registry_filepath,
                         testerchain):

    init_args = ('stake', 'new-stakeholder',
                 '--poa',
                 '--config-root', custom_filepath,
                 '--provider', TEST_PROVIDER_URI,
                 '--registry-filepath', mock_registry_filepath)

    result = click_runner.invoke(nucypher_cli,
                                 init_args,
                                 catch_exceptions=False)
    assert result.exit_code == 0

    # Files and Directories
    assert os.path.isdir(custom_filepath), 'Configuration file does not exist'

    custom_config_filepath = os.path.join(custom_filepath, StakeHolder.generate_filename())
    assert os.path.isfile(custom_config_filepath), 'Configuration file does not exist'

    with open(custom_config_filepath, 'r') as config_file:
        raw_config_data = config_file.read()
        config_data = json.loads(raw_config_data)
        assert config_data['blockchain']['provider_uri'] == TEST_PROVIDER_URI
def stakeholder_configuration_file_location(custom_filepath):
    _configuration_file_location = os.path.join(
        MOCK_CUSTOM_INSTALLATION_PATH, StakeHolder.generate_filename())
    return _configuration_file_location