when testing cli add wrapper for invoke method of CliRunner
We use CliRunner from typer library in a way similar to https://typer.tiangolo.com/tutorial/testing/
So for example in test for savings we invoke
result = runner.invoke(
cli,
[
"process",
"savings",
"deposit",
f"--amount={amount_to_deposit.as_legacy()}",
f"--password={WORKING_ACCOUNT.name}",
f"--sign={WORKING_ACCOUNT_KEY_ALIAS}",
],
)
We could have wrapper for this method as we use this very often in multiple scenarios for example smth like
process_savings_deposit(cli_with_runner, amount_to_deposit, WORKING_ACCOUNT.name, WORKING_ACCOUNT_KEY_ALIAS)
or
process_savings_deposit(cli_with_runner, amount=amount_to_deposit, password=WORKING_ACCOUNT.name, sign=WORKING_ACCOUNT_KEY_ALIAS)
This will apply not only for savings but for (almost) all cli tests
For the record here is discussion about this topic in tests for savings: !280 (comment 152961)
Edited by Marcin Sobczyk