Skip to content
Snippets Groups Projects
Commit fb8c1d26 authored by Moul's avatar Moul
Browse files

(cli) Rename tx command to transfer (#436)

parent 75114cb4
No related branches found
No related tags found
No related merge requests found
Pipeline #17437 passed
......@@ -59,7 +59,7 @@ MAX_OUTPUTS = 93
NBR_ISSUERS = 1
@click.command("tx", help="Send transaction")
@click.command("transfer", help="Transfer money")
@click.option(
"amounts",
"--amount",
......
......@@ -1060,7 +1060,7 @@ def compute_test_amounts(amounts, mult):
def construct_args(
amounts, amountsud, allsources, recipients, comment, outputbackchange, yes
):
args_list = ["tx"]
args_list = ["transfer"]
if yes:
args_list.append("--yes")
if amounts:
......
......@@ -122,42 +122,42 @@ def test_transaction_amount_errors(
def test_tx_passed_amount_cli():
# One option
result = CliRunner().invoke(cli, ["tx", "--amount", "1"])
result = CliRunner().invoke(cli, ["transfer", "--amount", "1"])
assert "Error: A recipient should be passed\n" in result.output
assert result.exit_code == 1
result = CliRunner().invoke(cli, ["tx", "--amountUD", "1"])
result = CliRunner().invoke(cli, ["transfer", "--amountUD", "1"])
assert "Error: A recipient should be passed\n" in result.output
assert result.exit_code == 1
result = CliRunner().invoke(cli, ["tx", "--allSources"])
result = CliRunner().invoke(cli, ["transfer", "--allSources"])
assert "Error: A recipient should be passed\n" in result.output
assert result.exit_code == 1
# Multiple options
result = CliRunner().invoke(cli, ["tx", "--amount", 1, "--amountUD", 1])
result = CliRunner().invoke(cli, ["transfer", "--amount", 1, "--amountUD", 1])
assert "Error: Usage" in result.output
assert result.exit_code == 2
result = CliRunner().invoke(cli, ["tx", "--amount", 1, "--allSources"])
result = CliRunner().invoke(cli, ["transfer", "--amount", 1, "--allSources"])
assert "Error: Usage" in result.output
assert result.exit_code == 2
result = CliRunner().invoke(cli, ["tx", "--amountUD", 1, "--allSources"])
result = CliRunner().invoke(cli, ["transfer", "--amountUD", 1, "--allSources"])
assert "Error: Usage" in result.output
assert result.exit_code == 2
result = CliRunner().invoke(
cli, ["tx", "--amount", 1, "--amountUD", 1, "--allSources"]
cli, ["transfer", "--amount", 1, "--amountUD", 1, "--allSources"]
)
assert "Error: Usage" in result.output
assert result.exit_code == 2
result = CliRunner().invoke(cli, ["tx", "-r", "A"])
result = CliRunner().invoke(cli, ["transfer", "-r", "A"])
assert "Error: amount, amountUD or allSources is not set." in result.output
assert result.exit_code == FAILURE_EXIT_STATUS
result = CliRunner().invoke(cli, ["tx", "-r", "A", "-r", "B", "--allSources"])
result = CliRunner().invoke(cli, ["transfer", "-r", "A", "-r", "B", "--allSources"])
assert (
"Error: the --allSources option can only be used with one recipient."
in result.output
......@@ -165,18 +165,18 @@ def test_tx_passed_amount_cli():
assert result.exit_code == FAILURE_EXIT_STATUS
result = CliRunner().invoke(
cli, ["tx", "-r", "A", "-a", MINIMAL_ABSOLUTE_TX_AMOUNT - 0.001]
cli, ["transfer", "-r", "A", "-a", MINIMAL_ABSOLUTE_TX_AMOUNT - 0.001]
)
assert "Error: Invalid value for '--amount'" in result.output
assert result.exit_code == 2
result = CliRunner().invoke(
cli, ["tx", "-r", "A", "-d", MINIMAL_RELATIVE_TX_AMOUNT - 0.0000001]
cli, ["transfer", "-r", "A", "-d", MINIMAL_RELATIVE_TX_AMOUNT - 0.0000001]
)
assert "Error: Invalid value for '--amountUD'" in result.output
assert result.exit_code == 2
result = CliRunner().invoke(cli, ["tx", "-r", "A", "-a", 1, "-a", 2])
result = CliRunner().invoke(cli, ["transfer", "-r", "A", "-a", 1, "-a", 2])
assert (
"Error: The number of passed recipients is not the same as the passed amounts."
in result.output
......@@ -184,7 +184,7 @@ def test_tx_passed_amount_cli():
assert result.exit_code == FAILURE_EXIT_STATUS
result = CliRunner().invoke(
cli, ["tx", "-r", "A", "-r", "B", "-r", "C", "-a", 1, "-a", 2]
cli, ["transfer", "-r", "A", "-r", "B", "-r", "C", "-a", 1, "-a", 2]
)
assert (
"Error: The number of passed recipients is not the same as the passed amounts."
......@@ -197,12 +197,12 @@ def test_tx_passed_amount_cli():
"arguments, auth_method, is_account_filled",
[
(
["tx", "--allSources", "-r", "A" * PUBKEY_MIN_LENGTH],
["transfer", "--allSources", "-r", "A" * PUBKEY_MIN_LENGTH],
patched_auth_method_truc,
False,
),
(
["tx", "--allSources", "-r", "A" * PUBKEY_MIN_LENGTH],
["transfer", "--allSources", "-r", "A" * PUBKEY_MIN_LENGTH],
patched_auth_method_riri,
True,
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment