api/misc: fix retrieving requested features from QubesDB
qdb.list return list of bytes().
This commit is contained in:
parent
5209bc370d
commit
55669c350c
@ -49,9 +49,11 @@ class QubesMiscAPI(qubes.api.AbstractQubesAPI):
|
|||||||
|
|
||||||
prefix = '/features-request/'
|
prefix = '/features-request/'
|
||||||
|
|
||||||
|
keys = [key.decode('ascii', errors='strict')
|
||||||
|
for key in self.src.qdb.list(prefix)]
|
||||||
untrusted_features = {key[len(prefix):]:
|
untrusted_features = {key[len(prefix):]:
|
||||||
self.src.qdb.read(key).decode('ascii', errors='strict')
|
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
|
safe_set = string.ascii_letters + string.digits
|
||||||
for untrusted_key in untrusted_features:
|
for untrusted_key in untrusted_features:
|
||||||
|
@ -38,7 +38,8 @@ class TC_00_API_Misc(qubes.tests.QubesTestCase):
|
|||||||
def configure_qdb(self, entries):
|
def configure_qdb(self, entries):
|
||||||
self.src.configure_mock(**{
|
self.src.configure_mock(**{
|
||||||
'qdb.read.side_effect': (lambda path: entries.get(path, None)),
|
'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''):
|
def call_mgmt_func(self, method, arg=b'', payload=b''):
|
||||||
|
Loading…
Reference in New Issue
Block a user