need new settings when create fake_config
This commit is contained in:
@ -159,7 +159,6 @@ def test_information_config():
|
||||
assert config.impl_get_information('noinfo', 'default') == 'default'
|
||||
|
||||
|
||||
#FIXME test impl_get_xxx pour OD ou ne pas cacher
|
||||
def test_config_impl_get_path_by_opt():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
@ -172,6 +171,14 @@ def test_config_impl_get_path_by_opt():
|
||||
raises(AttributeError, "config.cfgimpl_get_description().impl_get_path_by_opt(unknown)")
|
||||
|
||||
|
||||
def test_config_impl_get_path_by_opt_od():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
dummy = config.unwrap_from_path('gc.dummy')
|
||||
dummy
|
||||
raises(ConfigError, "config.cfgimpl_get_description().gc.impl_get_path_by_opt(dummy)")
|
||||
|
||||
|
||||
def test_config_impl_get_opt_by_path():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
|
@ -37,32 +37,6 @@ def make_description():
|
||||
return descr
|
||||
|
||||
|
||||
#FIXME
|
||||
#def test_compare_configs():
|
||||
# "config object comparison"
|
||||
# descr = make_description()
|
||||
# conf1 = Config(descr)
|
||||
# conf2 = Config(descr)
|
||||
# conf2.wantref = True
|
||||
# assert conf1 != conf2
|
||||
# assert hash(conf1) != hash(conf2)
|
||||
# #assert conf1.getkey() != conf2.getkey()
|
||||
# conf1.wantref = True
|
||||
# assert conf1 == conf2
|
||||
# assert hash(conf1) == hash(conf2)
|
||||
# #assert conf1.getkey() == conf2.getkey()
|
||||
# conf2.gc.dummy = True
|
||||
# assert conf1 != conf2
|
||||
# assert hash(conf1) != hash(conf2)
|
||||
# #assert conf1.getkey() != conf2.getkey()
|
||||
# conf1.gc.dummy = True
|
||||
# assert conf1 == conf2
|
||||
# assert hash(conf1) == hash(conf2)
|
||||
# assert not conf1 == 'conf2'
|
||||
# assert conf1 != 'conf2'
|
||||
# ____________________________________________________________
|
||||
|
||||
|
||||
def test_iter_config():
|
||||
"iteration on config object"
|
||||
s = StrOption("string", "", default="string")
|
||||
@ -304,3 +278,19 @@ def test_invalid_option():
|
||||
raises(ValueError, "DomainnameOption('a', '', allow_ip='string')")
|
||||
raises(ValueError, "DomainnameOption('a', '', allow_without_dot='string')")
|
||||
raises(ValueError, "DomainnameOption('a', '', 1)")
|
||||
#
|
||||
ChoiceOption('a', '', (1,), multi=True, default_multi=1)
|
||||
raises(ValueError, "ChoiceOption('a', '', (1,), default_multi=1)")
|
||||
raises(ValueError, "ChoiceOption('a', '', (1,), multi=True, default=[1,], default_multi=2)")
|
||||
raises(ValueError, "FloatOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "UnicodeOption('a', '', multi=True, default_multi=1)")
|
||||
raises(ValueError, "IPOption('a', '', multi=True, default_multi=1)")
|
||||
raises(ValueError, "IPOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "PortOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "PortOption('a', '', multi=True, default_multi='11:12:13', allow_range=True)")
|
||||
raises(ValueError, "PortOption('a', '', multi=True, default_multi=11111111111111111111)")
|
||||
raises(ValueError, "NetworkOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "NetmaskOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "BroadcastOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "DomainnameOption('a', '', multi=True, default_multi='string')")
|
||||
raises(ValueError, "DomainnameOption('a', '', multi=True, default_multi=1)")
|
||||
|
@ -30,8 +30,6 @@ def return_if_val(value):
|
||||
raise ValueError('error')
|
||||
|
||||
|
||||
#FIXME il y a une validation sur default_multi ?
|
||||
|
||||
def test_validator():
|
||||
opt1 = StrOption('opt1', '', validator=return_true, default='val')
|
||||
raises(ValueError, "StrOption('opt2', '', validator=return_false, default='val')")
|
||||
@ -62,6 +60,7 @@ def test_validator_params_key():
|
||||
|
||||
def test_validator_params_option():
|
||||
opt0 = StrOption('opt0', '', default='val')
|
||||
opt0
|
||||
raises(ValueError, "opt1 = StrOption('opt1', '', validator=return_true, validator_params={'': ((opt0, False),)}, default='val')")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user