test/gpg: init from the testing key directory
The old testing pattern set an attribute on the parser directly. Now that there is a parsed flag, use it instead.
This commit is contained in:
parent
f564b2abf7
commit
0e7071befe
@ -39,14 +39,6 @@ def testing_gpg_directory(tmpdir):
|
|||||||
gpg_util.GNUPGHOME = old_gpg_path
|
gpg_util.GNUPGHOME = old_gpg_path
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
|
||||||
def mock_gpg_config():
|
|
||||||
orig_gpg_keys_path = spack.gpg_keys_path
|
|
||||||
spack.gpg_keys_path = spack.mock_gpg_keys_path
|
|
||||||
yield
|
|
||||||
spack.gpg_keys_path = orig_gpg_keys_path
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
def gpg():
|
def gpg():
|
||||||
return SpackCommand('gpg')
|
return SpackCommand('gpg')
|
||||||
@ -60,16 +52,15 @@ def has_gnupg2():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail # TODO: fix failing tests.
|
|
||||||
@pytest.mark.skipif(not has_gnupg2(),
|
@pytest.mark.skipif(not has_gnupg2(),
|
||||||
reason='These tests require gnupg2')
|
reason='These tests require gnupg2')
|
||||||
def test_gpg(gpg, tmpdir, testing_gpg_directory, mock_gpg_config):
|
def test_gpg(gpg, tmpdir, testing_gpg_directory):
|
||||||
# Verify a file with an empty keyring.
|
# Verify a file with an empty keyring.
|
||||||
with pytest.raises(ProcessError):
|
with pytest.raises(ProcessError):
|
||||||
gpg('verify', os.path.join(spack.mock_gpg_data_path, 'content.txt'))
|
gpg('verify', os.path.join(spack.mock_gpg_data_path, 'content.txt'))
|
||||||
|
|
||||||
# Import the default key.
|
# Import the default key.
|
||||||
gpg('init')
|
gpg('init', '--from', spack.mock_gpg_keys_path)
|
||||||
|
|
||||||
# List the keys.
|
# List the keys.
|
||||||
# TODO: Test the output here.
|
# TODO: Test the output here.
|
||||||
|
Loading…
Reference in New Issue
Block a user