recalculate forced value when config.new()

This commit is contained in:
2018-09-12 22:16:00 +02:00
parent 5bc81f3749
commit e41af1fdce
3 changed files with 22 additions and 6 deletions

View File

@ -3,7 +3,7 @@ from .autopath import do_autopath
do_autopath()
from tiramisu.setting import groups
from tiramisu import Config
from tiramisu import Config, MetaConfig
from tiramisu import ChoiceOption, BoolOption, IntOption, \
StrOption, OptionDescription
from .test_state import _diff_opts, _diff_conf
@ -72,3 +72,14 @@ def test_copy_force_store_value():
conf.option('creole.general.wantref').value.set(True)
assert to_tuple(conf.value.exportation()) == (('creole.general.wantref',), (None,), (True,), ('user',))
assert to_tuple(conf2.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',))
def test_copy_force_store_value_metaconfig():
descr = make_description()
meta = MetaConfig([], optiondescription=descr)
conf = meta.config.new(session_id='conf')
assert to_tuple(conf.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',))
assert to_tuple(meta.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',))
conf.option('creole.general.wantref').value.set(True)
assert to_tuple(conf.value.exportation()) == (('creole.general.wantref',), (None,), (True,), ('user',))
assert to_tuple(meta.value.exportation()) == (('creole.general.wantref',), (None,), (False,), ('forced',))