diff --git a/tests/test_Configuration.py b/tests/test_Configuration.py index 4b34e91eb7ff91d0287367fdea9a7c9d96b4d1cb..96f9d05b38c47f8fcb402e9489520302af192b65 100644 --- a/tests/test_Configuration.py +++ b/tests/test_Configuration.py @@ -2,6 +2,7 @@ import datetime import decimal import os +import babel import pytest from . import any_date, relpath @@ -56,14 +57,17 @@ def test_historical_default_base(ini_filename, expected_currency, use_switch, an (decimal.Decimal('12.34'), 'gbp', 'IN', 'eur'), ]) def test_historical_argparsing_success(amount, from_curr, preposition, to_curr, any_date): + oxrlib.config.Configuration.TODAY = datetime.date(2017, 1, 1) + # This locale's currency should not be used in any test cases above. + oxrlib.config.Configuration.LOCALE = babel.core.Locale('en', 'IN') arglist = ['historical', any_date.isoformat()] arglist.extend(str(s) for s in [amount, from_curr, preposition, to_curr] if s is not None) config = config_from(os.devnull, arglist) + expect_to_curr = 'INR' if to_curr is None else to_curr.upper() assert config.args.amount == amount assert config.args.from_currency == from_curr.upper() - if to_curr is not None: - assert config.args.to_currency == to_curr.upper() + assert config.args.to_currency == expect_to_curr @pytest.mark.parametrize('arglist', [ ['100'],