mirror of
https://github.com/TheLocehiliosan/yadm
synced 2024-10-27 20:34:27 +00:00
Replace deprecated "pipes" with "shlex"
This commit is contained in:
parent
84437894b5
commit
9752d801ae
@ -1,7 +1,7 @@
|
|||||||
"""Test encryption"""
|
"""Test encryption"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pipes
|
import shlex
|
||||||
import time
|
import time
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -19,12 +19,12 @@ def add_asymmetric_key(runner, gnupg):
|
|||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['GNUPGHOME'] = gnupg.home
|
env['GNUPGHOME'] = gnupg.home
|
||||||
runner(
|
runner(
|
||||||
['gpg', '--import', pipes.quote(KEY_FILE)],
|
['gpg', '--import', shlex.quote(KEY_FILE)],
|
||||||
env=env,
|
env=env,
|
||||||
shell=True,
|
shell=True,
|
||||||
)
|
)
|
||||||
runner(
|
runner(
|
||||||
['gpg', '--import-ownertrust', '<', pipes.quote(KEY_TRUST)],
|
['gpg', '--import-ownertrust', '<', shlex.quote(KEY_TRUST)],
|
||||||
env=env,
|
env=env,
|
||||||
shell=True,
|
shell=True,
|
||||||
)
|
)
|
||||||
@ -37,7 +37,7 @@ def remove_asymmetric_key(runner, gnupg):
|
|||||||
runner(
|
runner(
|
||||||
[
|
[
|
||||||
'gpg', '--batch', '--yes',
|
'gpg', '--batch', '--yes',
|
||||||
'--delete-secret-keys', pipes.quote(KEY_FINGERPRINT)
|
'--delete-secret-keys', shlex.quote(KEY_FINGERPRINT)
|
||||||
],
|
],
|
||||||
env=env,
|
env=env,
|
||||||
shell=True,
|
shell=True,
|
||||||
@ -45,7 +45,7 @@ def remove_asymmetric_key(runner, gnupg):
|
|||||||
runner(
|
runner(
|
||||||
[
|
[
|
||||||
'gpg', '--batch', '--yes',
|
'gpg', '--batch', '--yes',
|
||||||
'--delete-key', pipes.quote(KEY_FINGERPRINT)
|
'--delete-key', shlex.quote(KEY_FINGERPRINT)
|
||||||
],
|
],
|
||||||
env=env,
|
env=env,
|
||||||
shell=True,
|
shell=True,
|
||||||
@ -149,7 +149,7 @@ def decrypt_targets(tmpdir_factory, runner, gnupg):
|
|||||||
['tar', 'cvf', '-'] +
|
['tar', 'cvf', '-'] +
|
||||||
expected +
|
expected +
|
||||||
['|', 'gpg', '--batch', '--yes', '-c'] +
|
['|', 'gpg', '--batch', '--yes', '-c'] +
|
||||||
['--output', pipes.quote(str(symmetric))],
|
['--output', shlex.quote(str(symmetric))],
|
||||||
cwd=tmpdir,
|
cwd=tmpdir,
|
||||||
env=env,
|
env=env,
|
||||||
shell=True)
|
shell=True)
|
||||||
@ -161,8 +161,8 @@ def decrypt_targets(tmpdir_factory, runner, gnupg):
|
|||||||
['tar', 'cvf', '-'] +
|
['tar', 'cvf', '-'] +
|
||||||
expected +
|
expected +
|
||||||
['|', 'gpg', '--batch', '--yes', '-e'] +
|
['|', 'gpg', '--batch', '--yes', '-e'] +
|
||||||
['-r', pipes.quote(KEY_NAME)] +
|
['-r', shlex.quote(KEY_NAME)] +
|
||||||
['--output', pipes.quote(str(asymmetric))],
|
['--output', shlex.quote(str(asymmetric))],
|
||||||
cwd=tmpdir,
|
cwd=tmpdir,
|
||||||
env=env,
|
env=env,
|
||||||
shell=True)
|
shell=True)
|
||||||
@ -465,7 +465,7 @@ def encrypted_data_valid(runner, gnupg, encrypted, expected):
|
|||||||
env['GNUPGHOME'] = gnupg.home
|
env['GNUPGHOME'] = gnupg.home
|
||||||
run = runner([
|
run = runner([
|
||||||
'gpg',
|
'gpg',
|
||||||
'-d', pipes.quote(str(encrypted)),
|
'-d', shlex.quote(str(encrypted)),
|
||||||
'2>/dev/null',
|
'2>/dev/null',
|
||||||
'|', 'tar', 't'], env=env, shell=True, report=False)
|
'|', 'tar', 't'], env=env, shell=True, report=False)
|
||||||
file_count = 0
|
file_count = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user