Fix setting VM property to None

None value should be encoded as empty string.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-25 12:30:19 +02:00
parent 1aab64d5b0
commit c988ef41a3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 3 additions and 1 deletions

View File

@ -211,6 +211,8 @@ class PropertyHolder(object):
else:
if isinstance(value, qubesadmin.vm.QubesVM):
value = value.name
if value is None:
value = ''
try:
self.qubesd_call(
self._method_dest,

View File

@ -145,7 +145,7 @@ class TC_00_Properties(qubesadmin.tests.vm.VMTestCase):
def test_024_set_none(self):
self.app.expected_calls[
('test-vm', 'admin.vm.property.Set', 'prop1', b'None')] = \
('test-vm', 'admin.vm.property.Set', 'prop1', b'')] = \
b'0\x00'
self.vm.prop1 = None
self.assertAllCalled()