File diff 9f0c30738db8 → c7fbf5b5d586
tests/test_config.py
Show inline comments
...
 
@@ -217,7 +217,7 @@ def test_rt_wrapper_cache_responds_to_external_credential_changes(rt_environ):
 
    assert rt1 is not rt2
 

	
 
def test_rt_wrapper_has_cache(tmp_path):
 
    with update_environ(XDG_CACHE_DIR=tmp_path), update_umask(0o002):
 
    with update_environ(XDG_CACHE_HOME=tmp_path), update_umask(0o002):
 
        config = config_mod.Config()
 
        rt = config.rt_wrapper(None, testutil.RTClient)
 
        rt.exists(1)
...
 
@@ -229,7 +229,7 @@ def test_rt_wrapper_has_cache(tmp_path):
 

	
 
def test_rt_wrapper_without_cache(tmp_path):
 
    tmp_path.chmod(0)
 
    with update_environ(XDG_CACHE_DIR=tmp_path):
 
    with update_environ(XDG_CACHE_HOME=tmp_path):
 
        config = config_mod.Config()
 
        rt = config.rt_wrapper(None, testutil.RTClient)
 
    tmp_path.chmod(0o600)
...
 
@@ -237,7 +237,7 @@ def test_rt_wrapper_without_cache(tmp_path):
 

	
 
def test_cache_mkdir(tmp_path):
 
    expected = tmp_path / 'TESTcache'
 
    with update_environ(XDG_CACHE_DIR=tmp_path):
 
    with update_environ(XDG_CACHE_HOME=tmp_path):
 
        config = config_mod.Config()
 
        cache_path = config.cache_dir_path(expected.name)
 
    assert cache_path == tmp_path / 'TESTcache'
...
 
@@ -246,7 +246,7 @@ def test_cache_mkdir(tmp_path):
 
def test_cache_mkdir_parent(tmp_path):
 
    xdg_cache_dir = tmp_path / 'xdgcache'
 
    expected = xdg_cache_dir / 'conservancy_beancount'
 
    with update_environ(XDG_CACHE_DIR=xdg_cache_dir):
 
    with update_environ(XDG_CACHE_HOME=xdg_cache_dir):
 
        config = config_mod.Config()
 
        cache_path = config.cache_dir_path(expected.name)
 
    assert cache_path == expected
...
 
@@ -254,7 +254,7 @@ def test_cache_mkdir_parent(tmp_path):
 

	
 
def test_cache_mkdir_from_home(tmp_path):
 
    expected = tmp_path / '.cache' / 'TESTcache'
 
    with update_environ(HOME=tmp_path, XDG_CACHE_DIR=None):
 
    with update_environ(HOME=tmp_path, XDG_CACHE_HOME=None):
 
        config = config_mod.Config()
 
        cache_path = config.cache_dir_path(expected.name)
 
    assert cache_path == expected
...
 
@@ -263,7 +263,7 @@ def test_cache_mkdir_from_home(tmp_path):
 
def test_cache_mkdir_exists_ok(tmp_path):
 
    expected = tmp_path / 'TESTcache'
 
    expected.mkdir()
 
    with update_environ(XDG_CACHE_DIR=tmp_path):
 
    with update_environ(XDG_CACHE_HOME=tmp_path):
 
        config = config_mod.Config()
 
        cache_path = config.cache_dir_path(expected.name)
 
    assert cache_path == expected
...
 
@@ -271,7 +271,7 @@ def test_cache_mkdir_exists_ok(tmp_path):
 
def test_cache_path_conflict(tmp_path):
 
    extant_path = tmp_path / 'TESTcache'
 
    extant_path.touch()
 
    with update_environ(XDG_CACHE_DIR=tmp_path):
 
    with update_environ(XDG_CACHE_HOME=tmp_path):
 
        config = config_mod.Config()
 
        cache_path = config.cache_dir_path(extant_path.name)
 
    assert cache_path is None
...
 
@@ -279,7 +279,7 @@ def test_cache_path_conflict(tmp_path):
 

	
 
def test_cache_path_parent_conflict(tmp_path):
 
    (tmp_path / '.cache').touch()
 
    with update_environ(HOME=tmp_path, XDG_CACHE_DIR=None):
 
    with update_environ(HOME=tmp_path, XDG_CACHE_HOME=None):
 
        config = config_mod.Config()
 
        assert config.cache_dir_path('TESTcache') is None