From 0664f917630005811fd591cedf08463f18fbbf4e Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Sun, 30 Oct 2022 11:39:43 +0100
Subject: [PATCH] Move money tests to unit directories (#441)

monkeypatch transfer_file
---
 tests/{ => unit}/money/__init__.py           |  0
 tests/{ => unit}/money/test_history.py       |  0
 tests/{ => unit}/money/test_tools.py         |  0
 tests/{ => unit}/money/test_transfer.py      |  0
 tests/{ => unit}/money/test_transfer_cli.py  |  0
 tests/{ => unit}/money/test_transfer_file.py | 12 +++++++-----
 6 files changed, 7 insertions(+), 5 deletions(-)
 rename tests/{ => unit}/money/__init__.py (100%)
 rename tests/{ => unit}/money/test_history.py (100%)
 rename tests/{ => unit}/money/test_tools.py (100%)
 rename tests/{ => unit}/money/test_transfer.py (100%)
 rename tests/{ => unit}/money/test_transfer_cli.py (100%)
 rename tests/{ => unit}/money/test_transfer_file.py (88%)

diff --git a/tests/money/__init__.py b/tests/unit/money/__init__.py
similarity index 100%
rename from tests/money/__init__.py
rename to tests/unit/money/__init__.py
diff --git a/tests/money/test_history.py b/tests/unit/money/test_history.py
similarity index 100%
rename from tests/money/test_history.py
rename to tests/unit/money/test_history.py
diff --git a/tests/money/test_tools.py b/tests/unit/money/test_tools.py
similarity index 100%
rename from tests/money/test_tools.py
rename to tests/unit/money/test_tools.py
diff --git a/tests/money/test_transfer.py b/tests/unit/money/test_transfer.py
similarity index 100%
rename from tests/money/test_transfer.py
rename to tests/unit/money/test_transfer.py
diff --git a/tests/money/test_transfer_cli.py b/tests/unit/money/test_transfer_cli.py
similarity index 100%
rename from tests/money/test_transfer_cli.py
rename to tests/unit/money/test_transfer_cli.py
diff --git a/tests/money/test_transfer_file.py b/tests/unit/money/test_transfer_file.py
similarity index 88%
rename from tests/money/test_transfer_file.py
rename to tests/unit/money/test_transfer_file.py
index 10a1ffae..def36115 100644
--- a/tests/money/test_transfer_file.py
+++ b/tests/unit/money/test_transfer_file.py
@@ -17,13 +17,13 @@ import pytest
 from click.testing import CliRunner
 
 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 tests.patched.money import patched_get_ud_value
+from tests.patched.test_constants import mock_ud_value
 
 FILE_PATH = "recipients.txt"
 
-ud_value = get_ud_value()
-
 
 @pytest.mark.parametrize(
     "file_content, amounts_exp, recipients_exp",
@@ -35,14 +35,16 @@ ud_value = get_ud_value()
         ),
         (
             "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"],
         ),
     ],
 )
 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()
     with runner.isolated_filesystem():
         with open(FILE_PATH, "w", encoding="utf-8") as f:
-- 
GitLab