slave's requires with multi is different than slave's requires with non multi option
This commit is contained in:
@ -603,13 +603,15 @@ def test_mandatory_slave():
|
||||
config.ip_admin_eth0.ip_admin_eth0.append('ip')
|
||||
config.read_only()
|
||||
assert config.ip_admin_eth0.ip_admin_eth0 == ['ip']
|
||||
raises(PropertiesOptionError, 'config.ip_admin_eth0.netmask_admin_eth0')
|
||||
assert len(config.ip_admin_eth0.netmask_admin_eth0) == 1
|
||||
raises(PropertiesOptionError, 'config.ip_admin_eth0.netmask_admin_eth0[0]')
|
||||
#
|
||||
config.read_write()
|
||||
config.ip_admin_eth0.netmask_admin_eth0 = ['']
|
||||
config.read_only()
|
||||
assert config.ip_admin_eth0.ip_admin_eth0 == ['ip']
|
||||
raises(PropertiesOptionError, 'config.ip_admin_eth0.netmask_admin_eth0')
|
||||
assert len(config.ip_admin_eth0.netmask_admin_eth0) == 1
|
||||
raises(PropertiesOptionError, 'config.ip_admin_eth0.netmask_admin_eth0[0]')
|
||||
#
|
||||
config.read_write()
|
||||
config.ip_admin_eth0.netmask_admin_eth0 = ['ip']
|
||||
|
@ -489,9 +489,9 @@ def test_reset_properties_force_store_value():
|
||||
|
||||
|
||||
def test_pprint():
|
||||
msg_error = _('cannot access to {} {} because has {} {}')
|
||||
msg_is = _("the value of {0} is {1}")
|
||||
msg_is_not = _("the value of {0} is not {1}")
|
||||
msg_error = _('cannot access to {} "{}" because has {} {}')
|
||||
msg_is = _('the value of "{0}" is "{1}"')
|
||||
msg_is_not = _('the value of "{0}" is not "{1}"')
|
||||
|
||||
s = StrOption("string", "", default=["string"], default_multi="string", multi=True, properties=('hidden', 'disabled'))
|
||||
s2 = StrOption("string2", "", default="string")
|
||||
@ -519,21 +519,21 @@ def test_pprint():
|
||||
except Exception, err:
|
||||
pass
|
||||
|
||||
assert str(err) == msg_error.format('option', 'str', 'properties', display_list(['disabled (' + display_list([msg_is.format('int', '1'), msg_is.format('string2', 'string')]) + ')', 'hidden (' + msg_is_not.format('int', display_list([2, 3, 4], 'or')) + ')']))
|
||||
assert str(err) == msg_error.format('option', 'Test string option', 'properties', display_list(['disabled (' + display_list([msg_is.format('string2', 'string'), msg_is.format('Test int option', '1')]) + ')', 'hidden (' + msg_is_not.format('Test int option', display_list([2, 3, 4], 'or')) + ')']))
|
||||
|
||||
try:
|
||||
config.options.val2
|
||||
except Exception, err:
|
||||
pass
|
||||
|
||||
assert str(err) == msg_error.format('optiondescription', 'options', 'property', 'hidden (' + msg_is.format('int', 1) + ')')
|
||||
assert str(err) == msg_error.format('optiondescription', 'options', 'property', 'hidden (' + msg_is.format('Test int option', 1) + ')')
|
||||
|
||||
try:
|
||||
config.val3
|
||||
except Exception, err:
|
||||
pass
|
||||
|
||||
assert str(err) == msg_error.format('option', 'val3', 'property', 'hidden (' + display_list([msg_is.format('int', 1), msg_is.format('string2', 'string'), msg_is_not.format('int', display_list([2, 3, 4], 'or'))]) + ')')
|
||||
assert str(err) == msg_error.format('option', 'val3', 'property', 'hidden (' + display_list([msg_is.format('string2', 'string'), msg_is.format('Test int option', 1), msg_is_not.format('Test int option', display_list([2, 3, 4], 'or'))]) + ')')
|
||||
|
||||
try:
|
||||
config.string
|
||||
|
@ -206,7 +206,7 @@ def test_groups_with_master_hidden_in_config2():
|
||||
raises(PropertiesOptionError, "cfg.getattr('netmask_admin_eth0')")
|
||||
cfg.ip_admin_eth0.append('192.168.1.1')
|
||||
assert cfg.ip_admin_eth0 == ['192.168.1.1']
|
||||
raises(PropertiesOptionError, "cfg.netmask_admin_eth0")
|
||||
raises(PropertiesOptionError, "cfg.netmask_admin_eth0[0]")
|
||||
del(cfg.ip_admin_eth0)
|
||||
assert cfg.ip_admin_eth0 == []
|
||||
#del
|
||||
|
Reference in New Issue
Block a user