diff --git a/tests/test_config.py b/tests/test_config.py index e503b8e11166515e3f36ac1c0842d3e3d96f6906..ef3a6438907bde57e1f244a71ab2c7621fad7df8 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -207,6 +207,22 @@ def test_rt_wrapper_cache_responds_to_external_credential_changes(rt_environ): rt2 = config.rt_wrapper(None, testutil.RTClient) assert rt1 is not rt2 +def test_rt_wrapper_has_cache(tmp_path): + with update_environ(XDG_CACHE_DIR=tmp_path): + config = config_mod.Config() + rt = config.rt_wrapper(None, testutil.RTClient) + rt.exists(1) + expected = 'conservancy_beancount/{}@*.sqlite3'.format(RT_FILE_CREDS[1]) + assert any(tmp_path.glob(expected)) + +def test_rt_wrapper_without_cache(tmp_path): + tmp_path.chmod(0) + with update_environ(XDG_CACHE_DIR=tmp_path): + config = config_mod.Config() + rt = config.rt_wrapper(None, testutil.RTClient) + tmp_path.chmod(0o600) + assert not any(tmp_path.iterdir()) + def test_cache_mkdir(tmp_path): expected = tmp_path / 'TESTcache' with update_environ(XDG_CACHE_DIR=tmp_path):