44from bgpcfgd .directory import Directory
55from bgpcfgd .template import TemplateFabric
66import bgpcfgd
7+ from copy import deepcopy
78
89
910swsscommon_module_mock = MagicMock ()
2627}
2728
2829@patch .dict ("sys.modules" , swsscommon = swsscommon_module_mock )
29- def set_del_test (op , args , currect_config , expected_config , gloabl_default_action = None ):
30+ def set_del_test (op , args , currect_config , expected_config , update_global_default_action = None ):
3031 from bgpcfgd .managers_allow_list import BGPAllowListMgr
3132 set_del_test .push_list_called = False
3233 def push_list (args ):
@@ -40,16 +41,16 @@ def push_list(args):
4041 cfg_mgr .update .return_value = None
4142 cfg_mgr .push_list = push_list
4243 cfg_mgr .get_text .return_value = currect_config
43- if gloabl_default_action :
44- global_constants ["bgp" ]["allow_list" ]["default_action" ] = gloabl_default_action
4544 common_objs = {
4645 'directory' : Directory (),
4746 'cfg_mgr' : cfg_mgr ,
4847 'tf' : TemplateFabric (),
49- 'constants' : global_constants ,
48+ 'constants' : deepcopy ( global_constants ) ,
5049 }
5150
5251 mgr = BGPAllowListMgr (common_objs , "CONFIG_DB" , "BGP_ALLOWED_PREFIXES" )
52+ if update_global_default_action :
53+ mgr .constants ["bgp" ]["allow_list" ]["default_action" ] = update_global_default_action
5354 if op == "SET" :
5455 mgr .set_handler (* args )
5556 elif op == "DEL" :
@@ -61,9 +62,6 @@ def push_list(args):
6162 else :
6263 assert not set_del_test .push_list_called , "cfg_mgr.push_list was called"
6364
64- global_constants ["bgp" ]["allow_list" ]["default_action" ] = "permit"
65-
66-
6765def test_set_handler_with_community ():
6866 set_del_test (
6967 "SET" ,
0 commit comments