Add QubesNoSuchPropertyError exception, expect it on invalid property
It inherits from AttributeError, so standard handling should just work.
This commit is contained in:
parent
fa66763628
commit
de2f23b9fe
@ -91,6 +91,11 @@ class QubesPropertyValueError(QubesValueError):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
class QubesNoSuchPropertyError(QubesException, AttributeError):
|
||||||
|
'''Requested property does not exist
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
class QubesNotImplementedError(QubesException, NotImplementedError):
|
class QubesNotImplementedError(QubesException, NotImplementedError):
|
||||||
'''Thrown at user when some feature is not implemented'''
|
'''Thrown at user when some feature is not implemented'''
|
||||||
|
|
||||||
|
@ -105,6 +105,16 @@ class TC_00_Properties(qubesadmin.tests.vm.VMTestCase):
|
|||||||
self.assertEqual(self.vm.property_is_default('prop1'), True)
|
self.assertEqual(self.vm.property_is_default('prop1'), True)
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
|
||||||
|
def test_012_get_invalid(self):
|
||||||
|
self.app.expected_calls[
|
||||||
|
('test-vm', 'admin.vm.property.Get', 'invalid', None)] = \
|
||||||
|
b'2\x00QubesNoSuchPropertyError\x00\x00Invalid property ' \
|
||||||
|
b'\'invalid\' on test-vm\x00'
|
||||||
|
with self.assertRaises(qubesadmin.exc.QubesNoSuchPropertyError):
|
||||||
|
self.vm.invalid
|
||||||
|
self.assertFalse(hasattr(self.vm, 'invalid'))
|
||||||
|
self.assertAllCalled()
|
||||||
|
|
||||||
def test_020_set_str(self):
|
def test_020_set_str(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.property.Set', 'prop1', b'value')] = \
|
('test-vm', 'admin.vm.property.Set', 'prop1', b'value')] = \
|
||||||
|
Loading…
Reference in New Issue
Block a user