Changeset - 3b5a563ef64b
[Not reviewed]
0 2 0
Brett Smith - 7 years ago 2017-05-17 16:56:19
brettcsmith@brettcsmith.org
historical: Write results to cache when appropriate.
2 files changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
oxrlib/commands/historical.py
Show inline comments
...
 
@@ -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),
tests/test_historical.py
Show inline comments
...
 
@@ -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):
0 comments (0 inline, 0 general)