mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-21 06:13:45 +00:00
add the ability to make a layer readonly
This commit is contained in:
parent
2a5448f5c1
commit
8372f198db
2 changed files with 61 additions and 21 deletions
15
test/property/test_property_readonly.py
Normal file
15
test/property/test_property_readonly.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from unittest import TestCase
|
||||
from owrx.property import PropertyLayer, PropertyReadOnly, PropertyWriteError
|
||||
|
||||
|
||||
class PropertyReadOnlyTest(TestCase):
|
||||
def testPreventsWrites(self):
|
||||
layer = PropertyLayer()
|
||||
layer["testkey"] = "initial value"
|
||||
ro = PropertyReadOnly(layer)
|
||||
with self.assertRaises(PropertyWriteError):
|
||||
ro["testkey"] = "new value"
|
||||
with self.assertRaises(PropertyWriteError):
|
||||
ro["otherkey"] = "testvalue"
|
||||
self.assertEqual(ro["testkey"], "initial value")
|
||||
self.assertNotIn("otherkey", ro)
|
||||
Loading…
Add table
Add a link
Reference in a new issue