Merge ~thomir-deactivatedaccount/gpgservice-client:use-tempfile-for-process-out into gpgservice-client:master

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 49a45eb6426567b6877370417cf7b05a438c7b15
Merged at revision: 49a45eb6426567b6877370417cf7b05a438c7b15
Proposed branch: ~thomir-deactivatedaccount/gpgservice-client:use-tempfile-for-process-out
Merge into: gpgservice-client:master
Diff against target: 36 lines (+14/-0)
2 files modified
gpgservice_client/client.py (+2/-0)
gpgservice_client/tests/test_gpgclient.py (+12/-0)
Reviewer Review Type Date Requested Status
Kit Randel (community) Approve
Review via email: mp+301131@code.launchpad.net

Commit message

Ensure we call write hooks when using the test interface.

Description of the change

oops - this branch has a terrible name. anyway...

Ensure we call write hooks when using the test interface. Fixes lp:1559833:

https://bugs.launchpad.net/gpgservice-client/+bug/1559833

To post a comment you must log in.
Revision history for this message
Kit Randel (blr) wrote :

lgtm, one very minor observation.

review: Approve
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/gpgservice_client/client.py b/gpgservice_client/client.py
2index 2a42418..efa9210 100644
3--- a/gpgservice_client/client.py
4+++ b/gpgservice_client/client.py
5@@ -221,6 +221,8 @@ class GPGClient:
6 "gpgservice was not configured with test endpoints enabled.")
7 elif resp.status_code != http_codes['OK']:
8 self.raise_for_error(resp)
9+ else:
10+ self._notify_writes()
11
12 def getKeyDetailsFromKeyServer(self, fingerprint):
13 """Get the details of a key from the configured key server.
14diff --git a/gpgservice_client/tests/test_gpgclient.py b/gpgservice_client/tests/test_gpgclient.py
15index b65d3b6..402be41 100644
16--- a/gpgservice_client/tests/test_gpgclient.py
17+++ b/gpgservice_client/tests/test_gpgclient.py
18@@ -352,6 +352,18 @@ class GPGClientTests(TestCase):
19 ContainsDict(dict(fingerprint=Equals(gpgkey_2['fingerprint'])))
20 ))
21
22+ def test_addKeyForTest_notifies_writes(self):
23+ write_hook = Mock()
24+ client = self.gpg_client
25+ client.registerWriteHook(write_hook)
26+ self.addCleanup(client.unregisterWriteHook, write_hook)
27+
28+ gpgkey = makeGPGKey()
29+ user = self.get_random_owner_id_string()
30+ client.addKeyForTest(user, **gpgkey)
31+
32+ self.assertTrue(write_hook.called)
33+
34 def test_retrieve_nonexistant_key_from_keyserver_returns_None(self):
35 client = self.gpg_client
36 gpgkey_1 = makeGPGKey()

Subscribers

People subscribed via source and target branches

to all changes: