From e7cbd7849aae6728b9b99efd86cf248b5bb0cda6 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 28 May 2019 07:19:26 +0200 Subject: [PATCH] add test for config's deepcopy --- tests/test_metaconfig.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_metaconfig.py b/tests/test_metaconfig.py index acd09e2..d463a9f 100644 --- a/tests/test_metaconfig.py +++ b/tests/test_metaconfig.py @@ -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")