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

[test] tx.transaction_amount: monkeypatch ud_value

To avoid non-necessary requests,
which wasn't working due to the membership tests which was closing the client

Found #335

Remove useless monkeypatch
parent c2ec2b27
No related branches found
No related tags found
No related merge requests found
Pipeline #9638 passed
...@@ -17,18 +17,21 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>. ...@@ -17,18 +17,21 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import pytest import pytest
from click.testing import CliRunner from click.testing import CliRunner
from silkaj.tx import transaction_amount from silkaj.tx import transaction_amount
from silkaj.money import UDValue from silkaj.money import UDValue
from silkaj.cli import cli from silkaj.cli import cli
from silkaj.constants import MINIMAL_TX_AMOUNT, FAILURE_EXIT_STATUS from silkaj.constants import MINIMAL_TX_AMOUNT, FAILURE_EXIT_STATUS
import patched
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_transaction_amount(): async def test_transaction_amount(monkeypatch):
"""test passed amounts passed tx command """test passed amounts passed tx command
float ≠ 100 does not give the exact value""" 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 = ( trials = (
# tests for --amount (unit) # tests for --amount (unit)
([141.89], None, ["A"], [14189]), ([141.89], None, ["A"], [14189]),
......
...@@ -52,7 +52,7 @@ def test_truncBase(amount, base, expected): ...@@ -52,7 +52,7 @@ def test_truncBase(amount, base, expected):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"message, amount, currency_symbol", [("Total", 1000, G1_SYMBOL)] "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 ud_value = patched.mock_ud_value
amount_UD = round(amount / ud_value, 2) amount_UD = round(amount / ud_value, 2)
expected = [ expected = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment