do not remove notempty and notunique properties
This commit is contained in:
@ -735,6 +735,19 @@ async def test_values_with_leader_and_followers_leader_pop():
|
||||
assert not await list_sessions()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_follower_unique():
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True)
|
||||
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "masque du sous-réseau", multi=True, properties=('unique',))
|
||||
interface1 = Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
|
||||
maconfig = OptionDescription('toto', '', [interface1])
|
||||
async with await Config(maconfig) as cfg:
|
||||
await cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(["192.168.230.145", "192.168.230.146"])
|
||||
# unique property is removed for a follower
|
||||
assert not await cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).property.get()
|
||||
assert not await list_sessions()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_values_with_leader_owner(config_type):
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True)
|
||||
@ -976,3 +989,28 @@ async def test_follower_force_store_value_reset():
|
||||
await cfg.option('od.interface0.ip_admin_eth0').value.reset()
|
||||
assert not await cfg.option('od.interface0.netmask_admin_eth0', 0).owner.isdefault()
|
||||
assert not await list_sessions()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_follower_properties():
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True)
|
||||
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "masque du sous-réseau", multi=True, properties=('aproperty',))
|
||||
interface1 = Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
|
||||
maconfig = OptionDescription('toto', '', [interface1])
|
||||
async with await Config(maconfig) as cfg:
|
||||
await cfg.property.read_write()
|
||||
await cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['1.1.1.1', '192.168.0.0'])
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0').property.get() == ('aproperty',)
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).property.get() == ('aproperty',)
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).property.get() == ('aproperty',)
|
||||
#
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).property.add('newproperty')
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0').property.get() == ('aproperty',)
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).property.get() == ('aproperty', 'newproperty')
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).property.get() == ('aproperty',)
|
||||
#
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0').property.add('newproperty1')
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0').property.get() == ('aproperty', 'newproperty1')
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).property.get() == ('aproperty', 'newproperty', 'newproperty1')
|
||||
await cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).property.get() == ('aproperty', 'newproperty1')
|
||||
assert not await list_sessions()
|
||||
|
@ -191,9 +191,9 @@ async def test_property_get_unique_empty():
|
||||
async with await Config(descr) as cfg:
|
||||
await cfg.property.read_write()
|
||||
assert await cfg.option('string').property.get() == {'empty', 'unique'}
|
||||
assert await cfg.option('string2').property.get() == {'empty'}
|
||||
assert await cfg.option('string3').property.get() == {'unique'}
|
||||
assert await cfg.option('string4').property.get() == set()
|
||||
assert await cfg.option('string2').property.get() == {'empty', 'notunique'}
|
||||
assert await cfg.option('string3').property.get() == {'unique', 'notempty'}
|
||||
assert await cfg.option('string4').property.get() == {'notunique', 'notempty'}
|
||||
assert not await list_sessions()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user