mirror of
https://github.com/TheLocehiliosan/yadm
synced 2026-03-02 03:49:29 +00:00
Support GNUPGHOME environment variable (#134)
This commit is contained in:
@@ -48,7 +48,7 @@ def test_pdirs_missing(runner, yadm_y, paths, home):
|
||||
# confirm directories are created before command is run:
|
||||
if home:
|
||||
assert re.search(
|
||||
(r'Creating.+\.gnupg.+Creating.+\.ssh.+'
|
||||
(r'Creating.+\.(gnupg|ssh).+Creating.+\.(gnupg|ssh).+'
|
||||
r'Running git command git status'),
|
||||
run.out, re.DOTALL), 'directories created before command is run'
|
||||
|
||||
|
||||
34
test/test_unit_private_dirs.py
Normal file
34
test/test_unit_private_dirs.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Unit tests: private_dirs"""
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'gnupghome',
|
||||
[True, False],
|
||||
ids=['gnupghome-set', 'gnupghome-unset'],
|
||||
)
|
||||
@pytest.mark.parametrize('param', ['all', 'gnupg'])
|
||||
def test_relative_path(runner, paths, gnupghome, param):
|
||||
"""Test translate_to_relative"""
|
||||
|
||||
alt_gnupghome = 'alt/gnupghome'
|
||||
env_gnupghome = paths.work.join(alt_gnupghome)
|
||||
|
||||
script = f"""
|
||||
YADM_TEST=1 source {paths.pgm}
|
||||
YADM_WORK={paths.work}
|
||||
private_dirs {param}
|
||||
"""
|
||||
|
||||
env = {}
|
||||
if gnupghome:
|
||||
env['GNUPGHOME'] = env_gnupghome
|
||||
|
||||
expected = alt_gnupghome if gnupghome else '.gnupg'
|
||||
if param == 'all':
|
||||
expected = f'.ssh {expected}'
|
||||
|
||||
run = runner(command=['bash'], inp=script, env=env)
|
||||
assert run.success
|
||||
assert run.err == ''
|
||||
assert run.out.strip() == expected
|
||||
Reference in New Issue
Block a user