add test for master/slave and callback

This commit is contained in:
2017-11-28 22:42:30 +01:00
parent 527ae40950
commit 9831f7cf0c
10 changed files with 808 additions and 446 deletions

View File

@ -591,7 +591,11 @@ class Settings(object):
#mandatory
if 'mandatory' in properties or 'empty' in properties:
value = 'pouet'
if self.validate_mandatory(opt_or_descr, index, value, properties):
if self.validate_mandatory(opt_or_descr,
index,
value,
setting_properties,
properties):
properties += set(['mandatory']) - set(['empty'])
else:
properties -= set(['mandatory', 'empty'])
@ -617,15 +621,21 @@ class Settings(object):
datas,
opt_type)
def validate_mandatory(self, opt, index, value, properties):
def validate_mandatory(self,
opt,
index,
value,
setting_properties,
properties):
values = self._getcontext().cfgimpl_get_values()
return 'mandatory' in properties and values.isempty(opt,
value,
index=index) or \
'empty' in properties and values.isempty(opt,
value,
force_allow_empty_list=True,
index=index)
return 'mandatory' in setting_properties and \
('mandatory' in properties and values.isempty(opt,
value,
index=index) or \
'empty' in properties and values.isempty(opt,
value,
force_allow_empty_list=True,
index=index))
#____________________________________________________________
# read only/read write