mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-04-04 14:08:38 +00:00
implement profile removal behaviour
This commit is contained in:
parent
2ba2ec38e0
commit
2e28694b49
3 changed files with 41 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from unittest import TestCase
|
||||
from unittest.mock import Mock
|
||||
from owrx.property import PropertyCarousel, PropertyLayer, PropertyDeleted
|
||||
from owrx.property import PropertyCarousel, PropertyLayer, PropertyDeleted, PropertyWriteError
|
||||
|
||||
|
||||
class PropertyCarouselTest(TestCase):
|
||||
|
|
@ -92,3 +92,28 @@ class PropertyCarouselTest(TestCase):
|
|||
pc.removeLayer("x")
|
||||
with self.assertRaises(KeyError):
|
||||
pc.switch("x")
|
||||
|
||||
def testPropertyResetAfterRemoval(self):
|
||||
pc = PropertyCarousel()
|
||||
pl = PropertyLayer(testkey="testvalue")
|
||||
pc.addLayer("x", pl)
|
||||
pc.switch("x")
|
||||
self.assertEqual(pc["testkey"], "testvalue")
|
||||
pc.removeLayer("x")
|
||||
with self.assertRaises(KeyError):
|
||||
x = pc["testkey"]
|
||||
|
||||
def testEmptySwitch(self):
|
||||
pc = PropertyCarousel()
|
||||
pl = PropertyLayer(testkey="testvalue")
|
||||
pc.addLayer("x", pl)
|
||||
pc.switch("x")
|
||||
self.assertEqual(pc["testkey"], "testvalue")
|
||||
pc.switch()
|
||||
with self.assertRaises(KeyError):
|
||||
x = pc["testkey"]
|
||||
|
||||
def testErrorOnWriteOnDefaultLayer(self):
|
||||
pc = PropertyCarousel()
|
||||
with self.assertRaises(PropertyWriteError):
|
||||
pc["testkey"] = "testvalue"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue