mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-04 14:07:32 +00:00
implement config layering
This commit is contained in:
parent
e926611307
commit
f23fa59ac3
20 changed files with 524 additions and 147 deletions
|
|
@ -4,6 +4,15 @@ from unittest.mock import Mock
|
|||
|
||||
|
||||
class PropertyLayerTest(TestCase):
|
||||
def testCreationWithKwArgs(self):
|
||||
pm = PropertyLayer(testkey="value")
|
||||
self.assertEqual(pm["testkey"], "value")
|
||||
|
||||
# this should be synonymous, so this is rather for illustration purposes
|
||||
contents = {"testkey": "value"}
|
||||
pm = PropertyLayer(**contents)
|
||||
self.assertEqual(pm["testkey"], "value")
|
||||
|
||||
def testKeyIsset(self):
|
||||
pm = PropertyLayer()
|
||||
self.assertFalse("some_key" in pm)
|
||||
|
|
|
|||
|
|
@ -185,3 +185,13 @@ class PropertyStackTest(TestCase):
|
|||
|
||||
stack.replaceLayer(0, second_layer)
|
||||
mock.method.assert_not_called()
|
||||
|
||||
def testWritesToExpectedLayer(self):
|
||||
om = PropertyStack()
|
||||
low_pm = PropertyLayer()
|
||||
high_pm = PropertyLayer()
|
||||
low_pm["testkey"] = "low value"
|
||||
om.addLayer(1, low_pm)
|
||||
om.addLayer(0, high_pm)
|
||||
om["testkey"] = "new value"
|
||||
self.assertEqual(low_pm["testkey"], "new value")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue