todict works with Metaconfig

This commit is contained in:
2019-08-03 21:03:23 +02:00
parent 1691e38db5
commit 113b7a3410
3 changed files with 51 additions and 46 deletions

View File

@ -1,6 +1,6 @@
# from json import dumps, loads
try:
from tiramisu_json_api import Config
from tiramisu_api import Config
class TestConfig(Config):
def __init__(self,
config):

View File

@ -8,6 +8,7 @@ from tiramisu import IntOption, StrOption, NetworkOption, NetmaskOption, BoolOpt
Params, ParamOption, ParamValue
from tiramisu.error import ConfigError, ConflictError, PropertiesOptionError, LeadershipError, APIError
from tiramisu.storage import list_sessions
from .config import config_type, get_config
def teardown_function(function):
@ -76,8 +77,6 @@ def test_path():
assert meta.config('conf2').config.path() == 'meta.conf2'
#FIXME ne pas mettre 2 meta dans une config
#FIXME ne pas mettre 2 OD differents dans un meta
def test_none():
meta = make_metaconfig()
assert meta.option('od1.i3').value.get() is meta.config('conf1').option('od1.i3').value.get() is meta.config('conf2').option('od1.i3').value.get() is None
@ -112,10 +111,13 @@ def test_none():
assert meta.config(None).config.name() == meta.config.name()
def test_reset():
def test_metaconfig_reset(config_type):
meta = make_metaconfig()
assert meta.option('od1.i2').value.get() == 1
meta.option('od1.i2').value.set(2)
meta_api = get_config(meta, config_type)
assert meta_api.option('od1.i2').value.get() == 1
meta_api.option('od1.i2').value.set(2)
if config_type == 'tiramisu-api':
meta_api.send()
meta.config('conf1').option('od1.i2').value.set(3)
assert meta.option('od1.i2').value.get() == 2
assert meta.config('conf1').option('od1.i2').value.get() == 3