-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Robin H. Johnson <[email protected]>
- Loading branch information
1 parent
6b8ff71
commit 9c918b3
Showing
1 changed file
with
9 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
IsolatedGPGEnvironment, | ||
PGPyEnvironment, | ||
get_wkd_url, | ||
has_advanced_wkd, | ||
OpenPGPSignatureList, | ||
OpenPGPSignatureData, | ||
OpenPGPSignatureStatus, | ||
|
@@ -854,9 +855,9 @@ def hkp_server(global_hkp_server): | |
'VALID_PUBLIC_KEY', None), | ||
]) | ||
def test_refresh_hkp(openpgp_env_with_refresh, hkp_server, manifest_var, | ||
key_var, server_key_fpr, server_key_var, expected): | ||
key_var, server_key_fpr, server_key_var, expected, monkeypatch): | ||
"""Test refreshing against a HKP keyserver""" | ||
# TODO: Need to mock socket.getaddrinfo to test this safely | ||
monkeypatch.setattr(gemato.openpgp, 'has_advanced_wkd', lambda _: True) | ||
try: | ||
if key_var is not None: | ||
with io.BytesIO(globals()[key_var]) as f: | ||
|
@@ -969,15 +970,16 @@ def test_refresh_wkd_fallback_to_hkp(openpgp_env_with_refresh, | |
|
||
|
||
@pytest.mark.parametrize( | ||
'email,expected', | ||
[('[email protected]', | ||
'email,has_advanced_wkd,expected', | ||
[('[email protected]', False, | ||
'https://example.com/.well-known/openpgpkey/hu/' | ||
'5x66h616iaskmnadrm86ndo6xnxbxjxb?l=gemato'), | ||
('[email protected]', | ||
'https://example.org/.well-known/openpgpkey/hu/' | ||
('[email protected]', True, | ||
'https://openpgpkey.example.org/.well-known/openpgpkey/example.org/hu/' | ||
'iy9q119eutrkn8s1mk4r39qejnbu3n5q?l=Joe.Doe'), | ||
]) | ||
def test_get_wkd_url(email, expected): | ||
def test_get_wkd_url(email, has_advanced_wkd, expected, monkeypatch): | ||
monkeypatch.setattr(gemato.openpgp, 'has_advanced_wkd', lambda _: has_advanced_wkd) | ||
assert get_wkd_url(email) == expected | ||
|
||
|
||
|