add _path in reset for performance + more tests
This commit is contained in:
@ -345,6 +345,10 @@ def test_reset_properties():
|
||||
setting.reset(all_properties=True)
|
||||
assert setting._p_.get_properties(cfg) == {}
|
||||
raises(ValueError, 'setting.reset(all_properties=True, opt=option)')
|
||||
a = descr.wantref
|
||||
setting[a].append('test')
|
||||
setting[a].reset()
|
||||
|
||||
|
||||
|
||||
def test_reset_multiple():
|
||||
|
@ -438,7 +438,12 @@ def test_requires_requirement_append():
|
||||
od = OptionDescription('service', '', [a, b])
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
str(c.cfgimpl_get_settings())
|
||||
str(c.cfgimpl_get_settings()[b])
|
||||
raises(ValueError, 'c.cfgimpl_get_settings()[b].append("disabled")')
|
||||
c.activate_service = False
|
||||
# disabled is now set, test to remove disabled before store in storage
|
||||
c.cfgimpl_get_settings()[b].append("test")
|
||||
|
||||
|
||||
def test_requires_recursive_path():
|
||||
@ -450,3 +455,24 @@ def test_requires_recursive_path():
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
raises(RequirementError, 'c.service.a')
|
||||
|
||||
|
||||
def test_get_properties_with_None_path():
|
||||
a = BoolOption('activate_service', '', True)
|
||||
b = IPOption('ip_address_service', '',
|
||||
requires=[{'option': a, 'expected': False, 'action': 'disabled'}])
|
||||
od1 = OptionDescription('service', '', [a, b], requires=[{'option': a, 'expected': False, 'action': 'disabled'}])
|
||||
od = OptionDescription('base', '', [od1])
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
raises(ValueError, "c.cfgimpl_get_settings()._getproperties(a)")
|
||||
|
||||
|
||||
def test_set_item():
|
||||
a = BoolOption('activate_service', '', True)
|
||||
b = IPOption('ip_address_service', '')
|
||||
od1 = OptionDescription('service', '', [a, b])
|
||||
od = OptionDescription('base', '', [od1])
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
raises(ValueError, 'c.cfgimpl_get_settings()[a] = ("test",)')
|
||||
|
Reference in New Issue
Block a user