update sqlalchemy storage for values et settings
This commit is contained in:
@ -7,6 +7,7 @@ from tiramisu.config import Config
|
||||
from tiramisu.option import IntOption, StrOption, UnicodeOption, OptionDescription, SymLinkOption
|
||||
from tiramisu.error import PropertiesOptionError, ConfigError
|
||||
from tiramisu.setting import groups
|
||||
from tiramisu.storage import delete_session
|
||||
|
||||
|
||||
def make_description():
|
||||
@ -352,6 +353,11 @@ def test_mandatory_warnings_rw():
|
||||
config.str = 'a'
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str1', 'unicode2', 'str3']
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings(force_permissive=True)) == ['str1', 'unicode2', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_disabled():
|
||||
@ -365,6 +371,11 @@ def test_mandatory_warnings_disabled():
|
||||
setting[descr.str].append('disabled')
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str1', 'unicode2', 'str3']
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings(force_permissive=True)) == ['str1', 'unicode2', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_hidden():
|
||||
@ -379,6 +390,11 @@ def test_mandatory_warnings_hidden():
|
||||
setting[descr.str].append('hidden')
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str1', 'unicode2', 'str3']
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings(force_permissive=True)) == ['str', 'str1', 'unicode2', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_frozen():
|
||||
@ -392,6 +408,11 @@ def test_mandatory_warnings_frozen():
|
||||
setting[descr.str].append('frozen')
|
||||
config.read_only()
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str', 'str1', 'unicode2', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_master():
|
||||
@ -406,6 +427,11 @@ def test_mandatory_master():
|
||||
config.read_only()
|
||||
raises(PropertiesOptionError, 'config.ip_admin_eth0.ip_admin_eth0')
|
||||
raises(PropertiesOptionError, 'config.ip_admin_eth0.netmask_admin_eth0')
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_master_empty():
|
||||
@ -445,6 +471,11 @@ def test_mandatory_master_empty():
|
||||
config.read_only()
|
||||
assert config.ip_admin_eth0.ip_admin_eth0 == ['ip']
|
||||
assert config.ip_admin_eth0.netmask_admin_eth0 == [None]
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_slave():
|
||||
@ -476,6 +507,11 @@ def test_mandatory_slave():
|
||||
config.read_only()
|
||||
assert config.ip_admin_eth0.ip_admin_eth0 == ['ip']
|
||||
assert config.ip_admin_eth0.netmask_admin_eth0 == ['ip']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_symlink():
|
||||
@ -489,6 +525,11 @@ def test_mandatory_warnings_symlink():
|
||||
setting[descr.str].append('frozen')
|
||||
config.read_only()
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str', 'str1', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_validate():
|
||||
@ -500,6 +541,11 @@ def test_mandatory_warnings_validate():
|
||||
config.str = 'test'
|
||||
raises(ValueError, "list(config.cfgimpl_get_values().mandatory_warnings())")
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str1', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_validate_empty():
|
||||
@ -509,6 +555,11 @@ def test_mandatory_warnings_validate_empty():
|
||||
config.read_only()
|
||||
raises(ConfigError, "list(config.cfgimpl_get_values().mandatory_warnings())")
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str', 'str1', 'str3', 'unicode1']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_warnings_requires():
|
||||
@ -523,6 +574,11 @@ def test_mandatory_warnings_requires():
|
||||
config.read_write()
|
||||
config.str = 'yes'
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str1', 'unicode2', 'str3']
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
||||
|
||||
def test_mandatory_od_disabled():
|
||||
@ -533,3 +589,8 @@ def test_mandatory_od_disabled():
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['tiram.str1', 'tiram.unicode2', 'tiram.str3']
|
||||
config.cfgimpl_get_settings()[descr].append('disabled')
|
||||
assert list(config.cfgimpl_get_values().mandatory_warnings()) == []
|
||||
try:
|
||||
delete_session('config', config.impl_getsessionid())
|
||||
except ValueError:
|
||||
pass
|
||||
del(config)
|
||||
|
Reference in New Issue
Block a user