From 6eba069fdb566fd006fa48b8b9c5d5b44085f524 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Fri, 25 Sep 2015 17:30:00 +0200 Subject: Add repair to pixelated maintenance - Issue #468 - Call with: pixelated-maintenance repair --- .../mailstore/maintenance/test_soledad_maintenance.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'service/test') diff --git a/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py b/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py index dc5d9d6c..9a89d62b 100644 --- a/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py +++ b/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py @@ -87,6 +87,18 @@ class TestSoledadMaintenance(unittest.TestCase): verify(soledad, never).delete_doc(other_doc) + @defer.inlineCallbacks + def test_repair_recreates_public_key_active_doc_if_necessary(self): + soledad = mock() + + private_key = self._private_key(SOME_EMAIL_ADDRESS, SOME_KEY_ID) + private_key_doc = SoledadDocument(doc_id='some_doc', json=private_key.get_json()) + when(soledad).get_all_docs().thenReturn(defer.succeed((1, [private_key_doc]))) + + yield SoledadMaintenance(soledad).repair() + + verify(soledad).create_doc_from_json('{"key_id": "4914254E384E264C", "tags": ["keymanager-active"], "type": "OpenPGPKey-active", "private": false, "address": "foo@example.tld"}') + def _public_key(self, address, keyid): return self._gpgkey(address, keyid, private=False) -- cgit v1.2.3