add test for config's deepcopy

This commit is contained in:
Emmanuel Garette 2019-05-28 07:19:26 +02:00
parent b9e9e98270
commit e7cbd7849a

View file

@ -921,6 +921,22 @@ def test_meta_properties_submeta_deepcopy():
assert meta_copy.config('copy_meta1').config('conf2').config.name() == 'conf2'
def test_meta_properties_deepcopy_meta():
ip_admin_eth0 = NetworkOption('ip_admin_eth0', "ip", multi=True, default=['192.168.1.1'])
netmask_admin_eth0 = NetmaskOption('netmask_admin_eth0', "mask", multi=True,
properties=('disabled',))
interface1 = OptionDescription('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
conf1 = Config(interface1, session_id='conf1')
conf1.property.read_write()
meta1 = MetaConfig([conf1], session_id='meta1')
meta2 = MetaConfig([meta1], session_id='meta2')
meta_copy = meta1.config.deepcopy(session_id='meta3',
metaconfig_prefix='copy_')
assert meta_copy.config.name() == 'copy_meta2'
assert meta_copy.config('meta3').config.name() == 'meta3'
assert list(meta_copy.config('meta3').config.list()) == []
def test_meta_properties_submeta_deepcopy_owner():
ip_admin_eth0 = NetworkOption('ip_admin_eth0', "ip")
netmask_admin_eth0 = NetmaskOption('netmask_admin_eth0', "mask")