mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Check param count only, not param order correctness
This change simplifies client 'createpaymentacct' method parameter validation. It no longer assumes parameter ordering is correct, and only verifies the string parameter count is correct. A unit test was also added to cli/test.sh This commit is in response to the requested change in PR 4308. https://github.com/bisq-network/bisq/pull/4308#pullrequestreview-435052357
This commit is contained in:
parent
52529a912e
commit
9691f35082
@ -202,19 +202,12 @@ public class CliMain {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case createpaymentacct: {
|
case createpaymentacct: {
|
||||||
if (nonOptionArgs.size() < 2)
|
if (nonOptionArgs.size() < 4)
|
||||||
throw new IllegalArgumentException("no account name specified");
|
throw new IllegalArgumentException(
|
||||||
|
"incorrect parameter count, expecting account name, account number, currency code");
|
||||||
|
|
||||||
var accountName = nonOptionArgs.get(1);
|
var accountName = nonOptionArgs.get(1);
|
||||||
|
|
||||||
if (nonOptionArgs.size() < 3)
|
|
||||||
throw new IllegalArgumentException("no account number specified");
|
|
||||||
|
|
||||||
var accountNumber = nonOptionArgs.get(2);
|
var accountNumber = nonOptionArgs.get(2);
|
||||||
|
|
||||||
if (nonOptionArgs.size() < 4)
|
|
||||||
throw new IllegalArgumentException("no fiat currency specified");
|
|
||||||
|
|
||||||
var fiatCurrencyCode = nonOptionArgs.get(3);
|
var fiatCurrencyCode = nonOptionArgs.get(3);
|
||||||
|
|
||||||
var request = CreatePaymentAccountRequest.newBuilder()
|
var request = CreatePaymentAccountRequest.newBuilder()
|
||||||
|
@ -166,6 +166,13 @@
|
|||||||
[ "$output" = "Error: address bogus not found in wallet" ]
|
[ "$output" = "Error: address bogus not found in wallet" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "test createpaymentacct PerfectMoneyDummy (missing nbr, ccy params)" {
|
||||||
|
run ./bisq-cli --password=xyz createpaymentacct PerfectMoneyDummy
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
echo "actual output: $output" >&2
|
||||||
|
[ "$output" = "Error: incorrect parameter count, expecting account name, account number, currency code" ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "test createpaymentacct PerfectMoneyDummy 0123456789 USD" {
|
@test "test createpaymentacct PerfectMoneyDummy 0123456789 USD" {
|
||||||
run ./bisq-cli --password=xyz createpaymentacct PerfectMoneyDummy 0123456789 USD
|
run ./bisq-cli --password=xyz createpaymentacct PerfectMoneyDummy 0123456789 USD
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
Loading…
Reference in New Issue
Block a user