Renaming authentication config file cli command (#865)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Lucas Saldanha 6 years ago committed by GitHub
parent 556877209e
commit c0291635d0
  1. 12
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  2. 8
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
  3. 2
      pantheon/src/test/resources/everything_config.toml

@ -463,10 +463,10 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
private final Boolean permissionsAccountsEnabled = false;
@Option(
names = {"--permissions-config-path"},
names = {"--permissions-config-file"},
description =
"Path to permissions config TOML file (default: a file named \"permissions_config.toml\" in the Pantheon data folder)")
private String permissionsConfigPath = null;
private String permissionsConfigFile = null;
@Option(
names = {"--privacy-enabled"},
@ -638,10 +638,10 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
}
}
private String getPermissionsConfigPath() {
private String getPermissionsConfigFile() {
return permissionsConfigPath != null
? permissionsConfigPath
return permissionsConfigFile != null
? permissionsConfigFile
: dataDir().toAbsolutePath()
+ System.getProperty("file.separator")
+ DefaultCommandValues.PERMISSIONING_CONFIG_LOCATION;
@ -763,7 +763,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
final PermissioningConfiguration permissioningConfiguration =
PermissioningConfigurationBuilder.permissioningConfigurationFromToml(
getPermissionsConfigPath(), permissionsNodesEnabled, permissionsAccountsEnabled);
getPermissionsConfigFile(), permissionsNodesEnabled, permissionsAccountsEnabled);
return Optional.of(permissioningConfiguration);
}

@ -316,19 +316,19 @@ public class PantheonCommandTest extends CommandTestAbstract {
@Test
public void permissionsTomlPathWithoutOptionMustDisplayUsage() {
parseCommand("--permissions-config-path");
parseCommand("--permissions-config-file");
verifyZeroInteractions(mockRunnerBuilder);
assertThat(commandErrorOutput.toString())
.startsWith("Missing required parameter for option '--permissions-config-path'");
.startsWith("Missing required parameter for option '--permissions-config-file'");
assertThat(commandOutput.toString()).isEmpty();
}
@Test
public void permissionsEnabledWithNonexistentConfigFileMustError() {
parseCommand(
"--permissions-accounts-enabled", "--permissions-config-path", "file-does-not-exist");
"--permissions-accounts-enabled", "--permissions-config-file", "file-does-not-exist");
verifyZeroInteractions(mockRunnerBuilder);
@ -344,7 +344,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
Files.write(permToml, Resources.toByteArray(configFile));
parseCommand(
"--permissions-accounts-enabled", "--permissions-config-path", permToml.toString());
"--permissions-accounts-enabled", "--permissions-config-file", permToml.toString());
PermissioningConfiguration permissioningConfiguration =
PermissioningConfiguration.createDefault();
permissioningConfiguration.setConfigurationFilePath(permToml.toString());

@ -73,7 +73,7 @@ min-gas-price="1"
# Permissioning
permissions-nodes-enabled=false
permissions-accounts-enabled=false
permissions-config-path="./permissions_config.toml"
permissions-config-file="./permissions_config.toml"
# Privacy
privacy-url="http://127.0.0.1:8888"

Loading…
Cancel
Save