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

Move money tests to unit directories (#441)

monkeypatch transfer_file
parent 2745999c
No related branches found
No related tags found
1 merge request!224Separate tests into unit and integration directories (#441)
File moved
File moved
File moved
File moved
...@@ -17,13 +17,13 @@ import pytest ...@@ -17,13 +17,13 @@ import pytest
from click.testing import CliRunner from click.testing import CliRunner
from silkaj.constants import CENT_MULT_TO_UNIT from silkaj.constants import CENT_MULT_TO_UNIT
from silkaj.money.tools import get_ud_value from silkaj.money import tools
from silkaj.money.transfer import parse_file_containing_amounts_recipients from silkaj.money.transfer import parse_file_containing_amounts_recipients
from tests.patched.money import patched_get_ud_value
from tests.patched.test_constants import mock_ud_value
FILE_PATH = "recipients.txt" FILE_PATH = "recipients.txt"
ud_value = get_ud_value()
@pytest.mark.parametrize( @pytest.mark.parametrize(
"file_content, amounts_exp, recipients_exp", "file_content, amounts_exp, recipients_exp",
...@@ -35,14 +35,16 @@ ud_value = get_ud_value() ...@@ -35,14 +35,16 @@ ud_value = get_ud_value()
), ),
( (
"RELATIVE\n#toto\n10 pubkey1\n#titi\n20 pubkey2", "RELATIVE\n#toto\n10 pubkey1\n#titi\n20 pubkey2",
[10 * ud_value, 20 * ud_value], [10 * mock_ud_value, 20 * mock_ud_value],
["pubkey1", "pubkey2"], ["pubkey1", "pubkey2"],
), ),
], ],
) )
def test_parse_file_containing_amounts_recipients( def test_parse_file_containing_amounts_recipients(
file_content, amounts_exp, recipients_exp file_content, amounts_exp, recipients_exp, monkeypatch
): ):
monkeypatch.setattr(tools, "get_ud_value", patched_get_ud_value)
runner = CliRunner() runner = CliRunner()
with runner.isolated_filesystem(): with runner.isolated_filesystem():
with open(FILE_PATH, "w", encoding="utf-8") as f: with open(FILE_PATH, "w", encoding="utf-8") as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment