test invalid owner in setowner

This commit is contained in:
Emmanuel Garette 2013-08-23 09:29:42 +02:00
parent ac62931525
commit 62553aba1f
2 changed files with 20 additions and 0 deletions

View File

@ -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')")

View File

@ -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',])")