require with slaves
This commit is contained in:
@ -69,18 +69,6 @@ def make_description3():
|
||||
return descr
|
||||
|
||||
|
||||
def make_description4():
|
||||
stroption = StrOption('str', 'Test string option', default="abc",
|
||||
properties=('mandatory', ))
|
||||
stroption1 = StrOption('str1', 'Test string option',
|
||||
properties=('mandatory', ))
|
||||
stroption2 = UnicodeOption('unicode2', 'Test string option',
|
||||
properties=('mandatory', ))
|
||||
stroption3 = StrOption('str3', 'Test string option', multi=True, requires=[{'option': stroption, 'expected': 'yes', 'action': 'mandatory', 'transitive': False}])
|
||||
descr = OptionDescription('tiram', '', [stroption, stroption1, stroption2, stroption3])
|
||||
return descr
|
||||
|
||||
|
||||
def test_mandatory_ro():
|
||||
descr = make_description()
|
||||
api = getapi(Config(descr))
|
||||
@ -557,7 +545,14 @@ def test_mandatory_warnings_validate_empty():
|
||||
|
||||
|
||||
def test_mandatory_warnings_requires():
|
||||
descr = make_description4()
|
||||
stroption = StrOption('str', 'Test string option', default="abc",
|
||||
properties=('mandatory', ))
|
||||
stroption1 = StrOption('str1', 'Test string option',
|
||||
properties=('mandatory', ))
|
||||
stroption2 = UnicodeOption('unicode2', 'Test string option',
|
||||
properties=('mandatory', ))
|
||||
stroption3 = StrOption('str3', 'Test string option', multi=True, requires=[{'option': stroption, 'expected': 'yes', 'action': 'mandatory', 'transitive': False}])
|
||||
descr = OptionDescription('tiram', '', [stroption, stroption1, stroption2, stroption3])
|
||||
api = getapi(Config(descr))
|
||||
api.option('str').value.set('')
|
||||
api.property.read_write()
|
||||
@ -570,6 +565,34 @@ def test_mandatory_warnings_requires():
|
||||
assert list(api.value.mandatory_warnings()) == ['str1', 'unicode2', 'str3']
|
||||
|
||||
|
||||
def test_mandatory_warnings_requires_masterslaves():
|
||||
stroption = StrOption('str', 'Test string option', default="abc",
|
||||
properties=('mandatory', ))
|
||||
stroption1 = StrOption('str1', 'Test string option', multi=True)
|
||||
stroption2 = StrOption('str2', 'Test string option', multi=True, requires=[{'option': stroption, 'expected': 'yes', 'action': 'mandatory', 'transitive': False}])
|
||||
masterslave = MasterSlaves('master', 'masterslaves', [stroption1, stroption2])
|
||||
descr = OptionDescription('tiram', '', [stroption, masterslave])
|
||||
api = getapi(Config(descr))
|
||||
api.option('str').value.set('')
|
||||
api.option('master.str1').value.set(['str'])
|
||||
assert list(api.value.mandatory_warnings()) == ['str']
|
||||
api.option('str').value.set('yes')
|
||||
assert list(api.value.mandatory_warnings()) == ['master.str2']
|
||||
|
||||
|
||||
def test_mandatory_warnings_requires_masterslaves_slave():
|
||||
stroption = StrOption('str', 'Test string option', multi=True)
|
||||
stroption1 = StrOption('str1', 'Test string option', multi=True)
|
||||
stroption2 = StrOption('str2', 'Test string option', multi=True, requires=[{'option': stroption1, 'expected': 'yes', 'action': 'mandatory', 'transitive': False}])
|
||||
masterslave = MasterSlaves('master', 'masterslaves', [stroption, stroption1, stroption2])
|
||||
descr = OptionDescription('tiram', '', [masterslave])
|
||||
api = getapi(Config(descr))
|
||||
api.option('master.str').value.set(['str'])
|
||||
assert list(api.value.mandatory_warnings()) == []
|
||||
api.option('master.str1', 0).value.set('yes')
|
||||
assert list(api.value.mandatory_warnings()) == ['master.str2']
|
||||
|
||||
|
||||
def test_mandatory_od_disabled():
|
||||
descr = make_description()
|
||||
descr = OptionDescription('od', '', [descr])
|
||||
|
Reference in New Issue
Block a user