test invalid owner in setowner
This commit is contained in:
parent
ac62931525
commit
62553aba1f
@ -1,4 +1,5 @@
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu.setting import owners
|
||||
from tiramisu.config import Config
|
||||
@ -60,3 +61,12 @@ def test_owner_is_not_a_string():
|
||||
assert isinstance(cfg.getowner('dummy'), owners.Owner)
|
||||
cfg.dummy = True
|
||||
assert cfg.getowner('dummy') == 'user'
|
||||
|
||||
|
||||
def test_setowner_without_valid_owner():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
cfg = Config(descr)
|
||||
assert cfg.dummy is False
|
||||
assert cfg.getowner('dummy') == 'default'
|
||||
raises(TypeError, "cfg.cfgimpl_get_settings().setowner('gen_config')")
|
||||
|
@ -1,5 +1,7 @@
|
||||
# coding: utf-8
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu.option import IntOption, OptionDescription
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.error import PropertiesOptionError
|
||||
@ -81,3 +83,11 @@ def test_permissive_frozen():
|
||||
except PropertiesOptionError, err:
|
||||
props = err.proptype
|
||||
assert props == ['frozen', 'disabled']
|
||||
|
||||
|
||||
def test_invalid_permissive():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
setting = config.cfgimpl_get_settings()
|
||||
config.read_write()
|
||||
raises(TypeError, "setting.setpermissive(['frozen', 'disabled',])")
|
||||
|
Loading…
Reference in New Issue
Block a user