From 435c22b68a9bc13e18b3772059ea1320517ef382 Mon Sep 17 00:00:00 2001
From: vtexier <vit@free.fr>
Date: Wed, 22 Apr 2020 12:27:23 +0200
Subject: [PATCH] [fix] #807 fix unit tests and README.md

---
 README.md                                  |  3 ++-
 tests/unit/money/test_quantitative_zsum.py | 12 ++++++------
 tests/unit/money/test_relative_zsum.py     | 12 ++++++------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 3ef1f263..f434688c 100644
--- a/README.md
+++ b/README.md
@@ -103,10 +103,11 @@ make check
 ```bash
 make tests
 ```
+> **Warning:** *do not run tests with sakia installed in your dev environment, because pytest will use the installed Sakia.*
 
 * Run only some unit tests by passing a special ENV variable:
 ```bash
-make tests TESTS_FILTER=tests.documents.test_block.TestBlock.test_fromraw
+make tests TESTS_FILTER=tests/functional/test_transfer_dialog.py::test_transfer
 ```
 
 ## Packaging and deploy
diff --git a/tests/unit/money/test_quantitative_zsum.py b/tests/unit/money/test_quantitative_zsum.py
index d2531559..185113fa 100644
--- a/tests/unit/money/test_quantitative_zsum.py
+++ b/tests/unit/money/test_quantitative_zsum.py
@@ -6,7 +6,7 @@ def test_value(application_with_one_connection, bob):
         110, bob.currency, application_with_one_connection, None
     )
     value = referential.value()
-    assert value == -10.79
+    assert value == 1.1
 
 
 def test_differential(application_with_one_connection, bob):
@@ -14,7 +14,7 @@ def test_differential(application_with_one_connection, bob):
         110, bob.currency, application_with_one_connection, None
     )
     value = referential.value()
-    assert value == -10.79
+    assert value == 1.1
 
 
 def test_localized_no_si(application_with_one_connection, bob):
@@ -22,7 +22,7 @@ def test_localized_no_si(application_with_one_connection, bob):
         110, bob.currency, application_with_one_connection, None
     )
     value = referential.localized(units=True)
-    assert value == "-10.79 Q0"
+    assert value == "1.10 Q0"
 
 
 def test_localized_with_si(application_with_one_connection, bob):
@@ -31,7 +31,7 @@ def test_localized_with_si(application_with_one_connection, bob):
         110 * 1000, bob.currency, application_with_one_connection, None
     )
     value = referential.localized(units=True, show_base=True)
-    assert value == "1,088.11 Q0"
+    assert value == "1,100.00 Q0"
 
 
 def test_localized_no_units_no_si(application_with_one_connection, bob):
@@ -40,7 +40,7 @@ def test_localized_no_units_no_si(application_with_one_connection, bob):
         110, bob.currency, application_with_one_connection, None
     )
     value = referential.localized(units=False, show_base=False)
-    assert value == "-10.79"
+    assert value == "1.10"
 
 
 def test_localized_no_units_with_si(application_with_one_connection, bob):
@@ -49,7 +49,7 @@ def test_localized_no_units_with_si(application_with_one_connection, bob):
         110 * 1000, bob.currency, application_with_one_connection, None
     )
     value = referential.localized(units=False, show_base=True)
-    assert value == "1,088.11"
+    assert value == "1,100.00"
 
 
 def test_diff_localized_no_si(application_with_one_connection, bob):
diff --git a/tests/unit/money/test_relative_zsum.py b/tests/unit/money/test_relative_zsum.py
index d0d1279f..f24268fb 100644
--- a/tests/unit/money/test_relative_zsum.py
+++ b/tests/unit/money/test_relative_zsum.py
@@ -7,19 +7,19 @@ def test_value(application_with_one_connection, bob):
         2702, bob.currency, application_with_one_connection, None
     )
     value = referential.value()
-    assert value == approx(8.70007)
+    assert value == approx(2702)
 
 
 def test_differential(application_with_one_connection, bob):
     referential = RelativeZSum(111, bob.currency, application_with_one_connection, None)
     value = referential.value()
-    assert value == approx(-3.521619496)
+    assert value == approx(111)
 
 
 def test_localized_no_si(application_with_one_connection, bob):
     referential = RelativeZSum(110, bob.currency, application_with_one_connection, None)
     value = referential.localized(units=True)
-    assert value == "-3.53 R0 UD"
+    assert value == "110.00 R0 UD"
 
 
 def test_localized_with_si(application_with_one_connection, bob):
@@ -27,7 +27,7 @@ def test_localized_with_si(application_with_one_connection, bob):
 
     referential = RelativeZSum(1, bob.currency, application_with_one_connection, None)
     value = referential.localized(units=True, show_base=True)
-    assert value == "-4.040487 R0 UD"
+    assert value == "1.000000 R0 UD"
 
 
 def test_localized_no_units_no_si(application_with_one_connection, bob):
@@ -35,7 +35,7 @@ def test_localized_no_units_no_si(application_with_one_connection, bob):
 
     referential = RelativeZSum(110, bob.currency, application_with_one_connection, None)
     value = referential.localized(units=False, show_base=False)
-    assert value == "-3.526336"
+    assert value == "110.000000"
 
 
 def test_localized_no_units_with_si(application_with_one_connection, bob):
@@ -43,7 +43,7 @@ def test_localized_no_units_with_si(application_with_one_connection, bob):
 
     referential = RelativeZSum(1, bob.currency, application_with_one_connection, None)
     value = referential.localized(units=False, show_base=True)
-    assert value == "-4.040487"
+    assert value == "1.000000"
 
 
 def test_diff_localized_no_si(application_with_one_connection, bob):
-- 
GitLab