summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-11-11 19:59:32 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-11-11 20:55:51 +0100
commit1dfad9725e39b0135a25a0739dc7fb4ee6bf92ee (patch)
tree7e8a45e6468220702c946bdc58e598e467ae7f76 /src/leap/bitmask
parent48a2bd04fa5a4095f0a5d8556c8113afb672664d (diff)
[bug] get user parameter in the key commands
This has been previously encapsulated in a dict, and the commands were not modified accordingly. I'm adding some very basic test for the KeymanagerService public api contract. - Resolves: #8577
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/cli/command.py2
-rw-r--r--src/leap/bitmask/core/mail_services.py10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/leap/bitmask/cli/command.py b/src/leap/bitmask/cli/command.py
index 1694956..16f483a 100644
--- a/src/leap/bitmask/cli/command.py
+++ b/src/leap/bitmask/cli/command.py
@@ -39,6 +39,8 @@ def _print_result(result):
def default_dict_printer(result):
+ if not result:
+ return
for key, value in result.items():
if value is None:
value = str(value)
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 183477a..b6c5404 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -18,7 +18,7 @@
Mail services.
This is quite moving work still.
-This should be moved to the different packages when it stabilizes.
+This should be moved to the different submodules when it stabilizes.
"""
import json
import os
@@ -398,19 +398,19 @@ class KeymanagerService(HookableService):
# commands
def do_list_keys(self, userid, private=False):
- km = self._container.get_instance(userid)
+ km = self._container.get_instance(userid['user'])
d = km.get_all_keys(private=private)
d.addCallback(lambda keys: [dict(key) for key in keys])
return d
def do_export(self, userid, address, private=False):
- km = self._container.get_instance(userid)
+ km = self._container.get_instance(userid['user'])
d = km.get_key(address, private=private, fetch_remote=False)
d.addCallback(lambda key: dict(key))
return d
def do_insert(self, userid, address, rawkey, validation='Fingerprint'):
- km = self._container.get_instance(userid)
+ km = self._container.get_instance(userid['user'])
validation = ValidationLevels.get(validation)
d = km.put_raw_key(rawkey, address, validation=validation)
d.addCallback(lambda _: km.get_key(address, fetch_remote=False))
@@ -419,7 +419,7 @@ class KeymanagerService(HookableService):
@defer.inlineCallbacks
def do_delete(self, userid, address, private=False):
- km = self._container.get_instance(userid)
+ km = self._container.get_instance(userid['user'])
key = yield km.get_key(address, private=private, fetch_remote=False)
km.delete_key(key)
defer.returnValue(key.fingerprint)