diff --git a/tests/test_tx.py b/tests/test_tx.py index 4ac609cda0756de4e51761fb833d92e81d6258f4..33d5b4d7f1c14c7546d77f057753b5a427fc1116 100644 --- a/tests/test_tx.py +++ b/tests/test_tx.py @@ -17,18 +17,21 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>. import pytest from click.testing import CliRunner + from silkaj.tx import transaction_amount from silkaj.money import UDValue from silkaj.cli import cli from silkaj.constants import MINIMAL_TX_AMOUNT, FAILURE_EXIT_STATUS +import patched @pytest.mark.asyncio -async def test_transaction_amount(): +async def test_transaction_amount(monkeypatch): """test passed amounts passed tx command float ≠ 100 does not give the exact value""" - udvalue = await UDValue().ud_value + monkeypatch.setattr(UDValue, "get_ud_value", patched.ud_value) + udvalue = patched.mock_ud_value trials = ( # tests for --amount (unit) ([141.89], None, ["A"], [14189]), diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py index 1925e49f3f47866e9c4a9f37430da3d7c4ffe4a0..2441e366acc2d0573e8ddd82699e782d01850a6a 100644 --- a/tests/test_unit_tx.py +++ b/tests/test_unit_tx.py @@ -52,7 +52,7 @@ def test_truncBase(amount, base, expected): @pytest.mark.parametrize( "message, amount, currency_symbol", [("Total", 1000, G1_SYMBOL)] ) -def test_display_amount(message, amount, currency_symbol, monkeypatch): +def test_display_amount(message, amount, currency_symbol): ud_value = patched.mock_ud_value amount_UD = round(amount / ud_value, 2) expected = [