mirror of
https://github.com/TheLocehiliosan/yadm
synced 2026-03-02 03:49:29 +00:00
Support XDG_DATA_HOME (#208)
* Create a YADM_DATA base (that is the source for repo & archive) * Add --yadm-data to override * Default YADM_DATA will be determined by XDG_DATA_HOME
This commit is contained in:
@@ -140,6 +140,7 @@ def supported_switches():
|
||||
'--yadm-archive',
|
||||
'--yadm-bootstrap',
|
||||
'--yadm-config',
|
||||
'--yadm-data',
|
||||
'--yadm-dir',
|
||||
'--yadm-encrypt',
|
||||
'--yadm-repo',
|
||||
|
||||
@@ -70,7 +70,7 @@ def run_test(runner, paths, args, expected_matches, expected_code=0):
|
||||
script = f"""
|
||||
YADM_TEST=1 HOME="{HOME}" source {paths.pgm}
|
||||
process_global_args {argstring}
|
||||
HOME="{HOME}" set_yadm_dir
|
||||
HOME="{HOME}" set_yadm_dirs
|
||||
configure_paths
|
||||
declare -p | grep -E '(YADM|GIT)_'
|
||||
"""
|
||||
|
||||
@@ -13,7 +13,7 @@ def test_get_cipher(runner, paths, condition):
|
||||
script = f"""
|
||||
YADM_TEST=1 source {paths.pgm}
|
||||
YADM_DIR="{paths.yadm}"
|
||||
set_yadm_dir
|
||||
set_yadm_dirs
|
||||
configure_paths
|
||||
_get_cipher test-archive
|
||||
echo "output_archive:$output_archive"
|
||||
@@ -37,7 +37,7 @@ def test_encrypt_decrypt(runner, paths, cipher, mode):
|
||||
script = f"""
|
||||
YADM_TEST=1 source {paths.pgm}
|
||||
YADM_DIR="{paths.yadm}"
|
||||
set_yadm_dir
|
||||
set_yadm_dirs
|
||||
configure_paths
|
||||
function mock_openssl() {{ echo openssl $*; }}
|
||||
function mock_gpg() {{ echo gpg $*; }}
|
||||
@@ -71,7 +71,7 @@ def test_get_openssl_ciphername(runner, paths, condition):
|
||||
script = f"""
|
||||
YADM_TEST=1 source {paths.pgm}
|
||||
YADM_DIR="{paths.yadm}"
|
||||
set_yadm_dir
|
||||
set_yadm_dirs
|
||||
configure_paths
|
||||
result=$(_get_openssl_ciphername)
|
||||
echo "result:$result"
|
||||
@@ -95,7 +95,7 @@ def test_set_openssl_options(runner, paths, condition):
|
||||
script = f"""
|
||||
YADM_TEST=1 source {paths.pgm}
|
||||
YADM_DIR="{paths.yadm}"
|
||||
set_yadm_dir
|
||||
set_yadm_dirs
|
||||
configure_paths
|
||||
function _get_openssl_ciphername() {{ echo "testcipher"; }}
|
||||
_set_openssl_options
|
||||
@@ -119,7 +119,7 @@ def test_set_gpg_options(runner, paths, recipient):
|
||||
script = f"""
|
||||
YADM_TEST=1 source {paths.pgm}
|
||||
YADM_DIR="{paths.yadm}"
|
||||
set_yadm_dir
|
||||
set_yadm_dirs
|
||||
configure_paths
|
||||
_set_gpg_options
|
||||
echo "result:${{GPG_OPTS[@]}}"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Unit tests: set_yadm_dir"""
|
||||
"""Unit tests: set_yadm_dirs"""
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import pytest
|
||||
'condition',
|
||||
['basic', 'override', 'xdg_config_home'],
|
||||
)
|
||||
def test_set_yadm_dir(runner, yadm, condition):
|
||||
"""Test set_yadm_dir"""
|
||||
def test_set_yadm_dirs(runner, yadm, condition):
|
||||
"""Test set_yadm_dirs"""
|
||||
setup = ''
|
||||
if condition == 'override':
|
||||
setup = 'YADM_DIR=/override'
|
||||
@@ -17,7 +17,7 @@ def test_set_yadm_dir(runner, yadm, condition):
|
||||
HOME=/testhome
|
||||
YADM_TEST=1 source {yadm}
|
||||
{setup}
|
||||
set_yadm_dir
|
||||
set_yadm_dirs
|
||||
echo "$YADM_DIR"
|
||||
"""
|
||||
run = runner(command=['bash'], inp=script)
|
||||
|
||||
Reference in New Issue
Block a user