diff --git a/silkaj/wot/revocation.py b/silkaj/wot/revocation.py index b824fceb37a69e504d3abaf962fef750abe1220f..c3e5ecb9d15d5f26e1f7b5527678f0594f27382a 100644 --- a/silkaj/wot/revocation.py +++ b/silkaj/wot/revocation.py @@ -27,7 +27,7 @@ from duniterpy.key.verifying_key import VerifyingKey from silkaj import auth, network, tui from silkaj.account_storage import AccountStorage -from silkaj.blockchain.tools import get_currency +from silkaj.blockchain import tools as bc_tools from silkaj.constants import FAILURE_EXIT_STATUS, SUCCESS_EXIT_STATUS from silkaj.public_key import gen_pubkey_checksum from silkaj.wot import idty_tools @@ -36,7 +36,7 @@ from silkaj.wot import tools as w_tools @click.command("create", help="Create and save a revocation document") def create() -> None: - currency = get_currency() + currency = bc_tools.get_currency() key = auth.auth_method() gen_pubkey_checksum(key.pubkey) @@ -62,7 +62,7 @@ def create() -> None: ) @click.pass_context def revoke_now(ctx: click.Context) -> None: - currency = get_currency() + currency = bc_tools.get_currency() warn_before_dry_run_or_display(ctx) diff --git a/tests/patched/blockchain_tools.py b/tests/patched/blockchain_tools.py index ed7b4c03d0f092ef69d35070a5da33cb2b5665f3..39fc9984a84bbfdf608570066770f15529e6083a 100644 --- a/tests/patched/blockchain_tools.py +++ b/tests/patched/blockchain_tools.py @@ -59,3 +59,11 @@ def patched_get_head_block(): def patched_get_head_block_gtest(): return mocked_block_gtest + + +def patched_get_currency(): + return currency + + +def patched_get_currency_gtest(): + return "g1-test" diff --git a/tests/unit/test_auth.py b/tests/unit/test_auth.py index 969765a92e7993d0c958f23ceace9704a55d3496..a98acfd560309f1632c88d6a075aeb57b7699a13 100644 --- a/tests/unit/test_auth.py +++ b/tests/unit/test_auth.py @@ -20,12 +20,14 @@ import pytest from click.testing import CliRunner from silkaj import auth, cli +from silkaj.blockchain import tools from tests.patched.auth import ( patched_auth_by_auth_file, patched_auth_by_scrypt, patched_auth_by_seed, patched_auth_by_wif, ) +from tests.patched.blockchain_tools import patched_get_currency @pytest.mark.parametrize( @@ -62,6 +64,7 @@ def test_authentication_cmd_cli(account, monkeypatch): patched_auth_options = Mock() monkeypatch.setattr(auth, "auth_options", patched_auth_options) monkeypatch.setattr(Path, "mkdir", Mock) + monkeypatch.setattr(tools, "get_currency", patched_get_currency) command = build_authentication_cmd(account) result = CliRunner().invoke(cli.cli, args=command) diff --git a/tests/unit/wot/test_revocation.py b/tests/unit/wot/test_revocation.py index 20e0c6f51d31455a3c139fa36414bc59b77bf4e1..c6deb82939502acc3768b8439a23385b444a623c 100644 --- a/tests/unit/wot/test_revocation.py +++ b/tests/unit/wot/test_revocation.py @@ -33,7 +33,10 @@ from silkaj.public_key import gen_pubkey_checksum from silkaj.wot import idty_tools, revocation from silkaj.wot import tools as w_tools from tests.patched.auth import patched_auth_method -from tests.patched.blockchain_tools import patched_get_head_block_gtest +from tests.patched.blockchain_tools import ( + patched_get_currency_gtest, + patched_get_head_block_gtest, +) from tests.patched.idty_tools import idty1, idty2, idty_block, lookup_one, lookup_two REVOCATION_PATH = Path("revocation.txt") @@ -662,7 +665,7 @@ def test_revocation_cli_revoke( monkeypatch, ): monkeypatch.setattr(auth, "auth_method", patched_auth_method_Claude) - monkeypatch.setattr(bc_tools, "get_head_block", patched_get_head_block_gtest) + monkeypatch.setattr(bc_tools, "get_currency", patched_get_currency_gtest) monkeypatch.setattr(w_tools, "choose_identity", patched_choose_identity) monkeypatch.setattr(bma.blockchain, "block", patch_get_id_block) patched_send_bma_revoke = Mock()