diff --git a/tests/python/api_tests/message_format_tests/condenser_api_tests/test_find_recurrent_transfers.py b/tests/python/api_tests/message_format_tests/condenser_api_tests/test_find_recurrent_transfers.py index d03148c621..402283ff7a 100644 --- a/tests/python/api_tests/message_format_tests/condenser_api_tests/test_find_recurrent_transfers.py +++ b/tests/python/api_tests/message_format_tests/condenser_api_tests/test_find_recurrent_transfers.py @@ -1,13 +1,16 @@ from __future__ import annotations +import pytest + import test_tools as tt from hive_local_tools import run_for @run_for("testnet", "mainnet_5m", "live_mainnet") -def test_find_recurrent_transfers(node: tt.InitNode | tt.RemoteNode, should_prepare: bool) -> None: +@pytest.mark.parametrize("asset", [tt.Asset.Test(10), tt.Asset.Tbd(10)]) +def test_find_recurrent_transfers(node: tt.InitNode | tt.RemoteNode, should_prepare: bool, asset: tt.Asset) -> None: if should_prepare: wallet = tt.Wallet(attach_to=node) wallet.api.create_account("initminer", "alice", "{}") - wallet.api.recurrent_transfer("initminer", "alice", tt.Asset.Test(10), "{}", 720, 12) + wallet.api.recurrent_transfer("initminer", "alice", asset, "{}", 720, 12) node.api.condenser.find_recurrent_transfers("initminer") diff --git a/tests/python/api_tests/message_format_tests/database_api_tests/test_find_recurrent_transfers.py b/tests/python/api_tests/message_format_tests/database_api_tests/test_find_recurrent_transfers.py index dd875c1123..a74e21b7ad 100644 --- a/tests/python/api_tests/message_format_tests/database_api_tests/test_find_recurrent_transfers.py +++ b/tests/python/api_tests/message_format_tests/database_api_tests/test_find_recurrent_transfers.py @@ -1,5 +1,7 @@ from __future__ import annotations +import pytest + import test_tools as tt from hive_local_tools import run_for @@ -9,12 +11,13 @@ # too. There is no listing method for recurrent_transfers, and they could run out of executions after some time. # See the readme.md file in this directory for further explanation. @run_for("testnet") -def test_find_recurrent_transfers(node: tt.InitNode) -> None: +@pytest.mark.parametrize("asset", [tt.Asset.Test(5), tt.Asset.Tbd(5)]) +def test_find_recurrent_transfers(node: tt.InitNode, asset: tt.Asset) -> None: wallet = tt.Wallet(attach_to=node) - wallet.create_account("alice", hives=tt.Asset.Test(100), vests=tt.Asset.Test(100)) + wallet.create_account("alice", hives=tt.Asset.Test(100), hbds=tt.Asset.Tbd(100), vests=tt.Asset.Test(100)) wallet.api.create_account("initminer", "bob", "{}") # create transfer from alice to bob for amount 5 test hives every 720 hours, repeat 12 times - wallet.api.recurrent_transfer("alice", "bob", tt.Asset.Test(5), "memo", 720, 12) + wallet.api.recurrent_transfer("alice", "bob", asset, "memo", 720, 12) # "from" is a Python keyword and needs workaround recurrent_transfers = node.api.database.find_recurrent_transfers(**{"from": "alice"}).recurrent_transfers assert len(recurrent_transfers) != 0 diff --git a/tests/python/api_tests/message_format_tests/wallet_bridge_api_tests/test_find_recurrent_transfers.py b/tests/python/api_tests/message_format_tests/wallet_bridge_api_tests/test_find_recurrent_transfers.py index bf8f6c12f6..8b96d8d80b 100644 --- a/tests/python/api_tests/message_format_tests/wallet_bridge_api_tests/test_find_recurrent_transfers.py +++ b/tests/python/api_tests/message_format_tests/wallet_bridge_api_tests/test_find_recurrent_transfers.py @@ -14,13 +14,14 @@ "bob", ], ) +@pytest.mark.parametrize("asset", [tt.Asset.Test(20), tt.Asset.Tbd(20)]) @run_for("testnet", "mainnet_5m", "live_mainnet") def test_find_recurrent_transfers_with_correct_value( - node: tt.InitNode | tt.RemoteNode, should_prepare: bool, reward_fund_name: str + node: tt.InitNode | tt.RemoteNode, should_prepare: bool, reward_fund_name: str, asset: tt.Asset ) -> None: if should_prepare: wallet = tt.Wallet(attach_to=node) - create_accounts_and_make_recurrent_transfer(wallet, from_account="alice", to_account="bob") + create_accounts_and_make_recurrent_transfer(wallet, from_account="alice", to_account="bob", asset=asset) node.api.wallet_bridge.find_recurrent_transfers(reward_fund_name) @@ -49,34 +50,39 @@ def test_find_recurrent_transfers_with_incorrect_value( @pytest.mark.parametrize("reward_fund_name", [["alice"]]) +@pytest.mark.parametrize("asset", [tt.Asset.Test(20), tt.Asset.Tbd(20)]) @run_for("testnet", "mainnet_5m", "live_mainnet") def test_find_recurrent_transfers_with_incorrect_type_of_argument( - node: tt.InitNode | tt.RemoteNode, should_prepare: bool, reward_fund_name: list + node: tt.InitNode | tt.RemoteNode, should_prepare: bool, reward_fund_name: list, asset: tt.Asset ) -> None: if should_prepare: wallet = tt.Wallet(attach_to=node) - create_accounts_and_make_recurrent_transfer(wallet, from_account="alice", to_account="bob") + create_accounts_and_make_recurrent_transfer(wallet, from_account="alice", to_account="bob", asset=asset) with pytest.raises(tt.exceptions.CommunicationError): node.api.wallet_bridge.find_recurrent_transfers(reward_fund_name) @run_for("testnet", "mainnet_5m", "live_mainnet") +@pytest.mark.parametrize("asset", [tt.Asset.Test(20), tt.Asset.Tbd(20)]) def test_find_recurrent_transfers_with_additional_argument( - node: tt.InitNode | tt.RemoteNode, should_prepare: bool + node: tt.InitNode | tt.RemoteNode, should_prepare: bool, asset: tt.Asset ) -> None: if should_prepare: wallet = tt.Wallet(attach_to=node) - create_accounts_and_make_recurrent_transfer(wallet, from_account="alice", to_account="bob") + create_accounts_and_make_recurrent_transfer(wallet, from_account="alice", to_account="bob", asset=asset) node.api.wallet_bridge.find_recurrent_transfers("alice", "additional_argument") -def create_accounts_and_make_recurrent_transfer(wallet: tt.Wallet, from_account: str, to_account: str) -> None: +def create_accounts_and_make_recurrent_transfer( + wallet: tt.Wallet, from_account: str, to_account: str, asset: tt.Asset +) -> None: with wallet.in_single_transaction(): wallet.api.create_account("initminer", from_account, "{}") wallet.api.create_account("initminer", to_account, "{}") wallet.api.transfer_to_vesting("initminer", from_account, tt.Asset.Test(100)) wallet.api.transfer("initminer", from_account, tt.Asset.Test(500), "memo") - wallet.api.recurrent_transfer(from_account, to_account, tt.Asset.Test(20), "memo", 100, 10) + wallet.api.transfer("initminer", from_account, tt.Asset.Tbd(500), "memo") + wallet.api.recurrent_transfer(from_account, to_account, asset, "memo", 100, 10)