api/misc: fix retrieving requested features from QubesDB

qdb.list return list of bytes().
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-14 03:45:08 +02:00
parent 5209bc370d
commit 55669c350c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 5 additions and 2 deletions

View File

@ -49,9 +49,11 @@ class QubesMiscAPI(qubes.api.AbstractQubesAPI):
prefix = '/features-request/'
keys = [key.decode('ascii', errors='strict')
for key in self.src.qdb.list(prefix)]
untrusted_features = {key[len(prefix):]:
self.src.qdb.read(key).decode('ascii', errors='strict')
for key in self.src.qdb.list(prefix)}
for key in keys}
safe_set = string.ascii_letters + string.digits
for untrusted_key in untrusted_features:

View File

@ -38,7 +38,8 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
def configure_qdb(self, entries):
self.src.configure_mock(**{
'qdb.read.side_effect': (lambda path: entries.get(path, None)),
'qdb.list.side_effect': (lambda path: sorted(entries.keys())),
'qdb.list.side_effect': (lambda path:
sorted(map(str.encode, entries.keys()))),
})
def call_mgmt_func(self, method, arg=b'', payload=b''):