diff --git a/ihatemoney/tests/budget_test.py b/ihatemoney/tests/budget_test.py index 460036dc..0434864c 100644 --- a/ihatemoney/tests/budget_test.py +++ b/ihatemoney/tests/budget_test.py @@ -804,7 +804,8 @@ class BudgetTestCase(IhatemoneyTestCase): self.assertEqual(response.status_code, 200) def test_statistics(self): - self.post_project("raclette") + # Output is checked with the USD sign + self.post_project("raclette", default_currency="USD") # add members self.client.post("/raclette/members/add", data={"name": "zorglub", "weight": 2}) @@ -1447,7 +1448,7 @@ class BudgetTestCase(IhatemoneyTestCase): def test_currency_switch(self): - mock_data = {"USD": 1, "EUR": 0.8, "CAD": 1.2} + mock_data = {"USD": 1, "EUR": 0.8, "CAD": 1.2, CurrencyConverter.no_currency: 1} converter = CurrencyConverter() converter.get_rates = MagicMock(return_value=mock_data) diff --git a/ihatemoney/tests/common/ihatemoney_testcase.py b/ihatemoney/tests/common/ihatemoney_testcase.py index 2e590590..39b2919e 100644 --- a/ihatemoney/tests/common/ihatemoney_testcase.py +++ b/ihatemoney/tests/common/ihatemoney_testcase.py @@ -30,7 +30,7 @@ class BaseTestCase(TestCase): follow_redirects=True, ) - def post_project(self, name, follow_redirects=True): + def post_project(self, name, follow_redirects=True, default_currency="XXX"): """Create a fake project""" # create the project return self.client.post( @@ -40,18 +40,18 @@ class BaseTestCase(TestCase): "id": name, "password": name, "contact_email": f"{name}@notmyidea.org", - "default_currency": "USD", + "default_currency": default_currency, }, follow_redirects=follow_redirects, ) - def create_project(self, name): + def create_project(self, name, default_currency="XXX"): project = models.Project( id=name, name=str(name), password=generate_password_hash(name), contact_email=f"{name}@notmyidea.org", - default_currency="USD", + default_currency=default_currency, ) models.db.session.add(project) models.db.session.commit() diff --git a/ihatemoney/tests/history_test.py b/ihatemoney/tests/history_test.py index 3ffdbcc6..cee3dca6 100644 --- a/ihatemoney/tests/history_test.py +++ b/ihatemoney/tests/history_test.py @@ -25,7 +25,7 @@ class HistoryTestCase(IhatemoneyTestCase): "name": "demo", "contact_email": "demo@notmyidea.org", "password": "demo", - "default_currency": "USD", + "default_currency": "XXX", } if logging_preference != LoggingMode.DISABLED: @@ -78,7 +78,7 @@ class HistoryTestCase(IhatemoneyTestCase): "contact_email": "demo2@notmyidea.org", "password": "123456", "project_history": "y", - "default_currency": "USD", + "default_currency": "USD", # Currency changed from default } resp = self.client.post("/demo/edit", data=new_data, follow_redirects=True) @@ -103,7 +103,7 @@ class HistoryTestCase(IhatemoneyTestCase): resp.data.decode("utf-8").index("Project renamed "), resp.data.decode("utf-8").index("Project private code changed"), ) - self.assertEqual(resp.data.decode("utf-8").count("