diff --git a/oxrlib/commands/historical.py b/oxrlib/commands/historical.py index c7d7f705a83bfed9c93a6a84885b55e19be2ce9b..075fa8386d13c994058ab6ec7ab0c32a62ba244b 100644 --- a/oxrlib/commands/historical.py +++ b/oxrlib/commands/historical.py @@ -12,6 +12,8 @@ def run(config, stdout, stderr): loaders = config.get_loaders() with loaders.historical(config.args.date, config.args.base) as rate_json: rate = oxrrate.Rate.from_json_file(rate_json) + if loaders.should_cache(): + config.cache.save_rate(rate) if not config.args.from_currency: for from_curr in sorted(rate.rates): print(*format_rate_pair(rate, from_curr, config.args.to_currency), diff --git a/tests/test_historical.py b/tests/test_historical.py index cacac1cbee155798e9db24aa54cddf32cf2e201e..f8dfcfcf4ba0091ed2cae4d8ae435f3219cce38f 100644 --- a/tests/test_historical.py +++ b/tests/test_historical.py @@ -19,6 +19,9 @@ class FakeResponder: def __getattr__(self, name): return self._respond + def should_cache(self): + return False + class FakeConfig: def __init__(self, responder, argvars=None):