@@ -461,66 +461,9 @@ def setup_class(cls):
461
461
print ("SETUP" )
462
462
import config .main
463
463
importlib .reload (config .main )
464
-
465
- def add_sysinfo_to_cfg_file (self ):
466
- with open (self .dummy_cfg_file , 'w' ) as f :
467
- device_metadata = {
468
- "DEVICE_METADATA" : {
469
- "localhost" : {
470
- "platform" : "some_platform" ,
471
- "mac" : "02:42:f0:7f:01:05"
472
- }
473
- }
474
- }
475
- f .write (json .dumps (device_metadata ))
476
-
477
- def test_reload_config_invalid_input (self , get_cmd_module , setup_single_broadcom_asic ):
478
- open (self .dummy_cfg_file , 'w' ).close ()
479
- with mock .patch (
480
- "utilities_common.cli.run_command" ,
481
- mock .MagicMock (side_effect = mock_run_command_side_effect )
482
- ) as mock_run_command :
483
- (config , show ) = get_cmd_module
484
- runner = CliRunner ()
485
-
486
- result = runner .invoke (
487
- config .config .commands ["reload" ],
488
- [self .dummy_cfg_file , '-y' , '-f' ])
489
-
490
- print (result .exit_code )
491
- print (result .output )
492
- traceback .print_tb (result .exc_info [2 ])
493
- assert result .exit_code != 0
494
-
495
- def test_reload_config_no_sysinfo (self , get_cmd_module , setup_single_broadcom_asic ):
496
- with open (self .dummy_cfg_file , 'w' ) as f :
497
- device_metadata = {
498
- "DEVICE_METADATA" : {
499
- "localhost" : {
500
- "hwsku" : "some_hwsku"
501
- }
502
- }
503
- }
504
- f .write (json .dumps (device_metadata ))
505
-
506
- with mock .patch (
507
- "utilities_common.cli.run_command" ,
508
- mock .MagicMock (side_effect = mock_run_command_side_effect )
509
- ) as mock_run_command :
510
- (config , show ) = get_cmd_module
511
- runner = CliRunner ()
512
-
513
- result = runner .invoke (
514
- config .config .commands ["reload" ],
515
- [self .dummy_cfg_file , '-y' , '-f' ])
516
-
517
- print (result .exit_code )
518
- print (result .output )
519
- traceback .print_tb (result .exc_info [2 ])
520
- assert result .exit_code == 0
464
+ open (cls .dummy_cfg_file , 'w' ).close ()
521
465
522
466
def test_reload_config (self , get_cmd_module , setup_single_broadcom_asic ):
523
- self .add_sysinfo_to_cfg_file ()
524
467
with mock .patch (
525
468
"utilities_common.cli.run_command" ,
526
469
mock .MagicMock (side_effect = mock_run_command_side_effect )
@@ -540,7 +483,6 @@ def test_reload_config(self, get_cmd_module, setup_single_broadcom_asic):
540
483
== RELOAD_CONFIG_DB_OUTPUT
541
484
542
485
def test_config_reload_disabled_service (self , get_cmd_module , setup_single_broadcom_asic ):
543
- self .add_sysinfo_to_cfg_file ()
544
486
with mock .patch (
545
487
"utilities_common.cli.run_command" ,
546
488
mock .MagicMock (side_effect = mock_run_command_side_effect_disabled_timer )
@@ -560,7 +502,6 @@ def test_config_reload_disabled_service(self, get_cmd_module, setup_single_broad
560
502
assert "\n " .join ([l .rstrip () for l in result .output .split ('\n ' )]) == reload_config_with_disabled_service_output
561
503
562
504
def test_reload_config_masic (self , get_cmd_module , setup_multi_broadcom_masic ):
563
- self .add_sysinfo_to_cfg_file ()
564
505
with mock .patch (
565
506
"utilities_common.cli.run_command" ,
566
507
mock .MagicMock (side_effect = mock_run_command_side_effect )
0 commit comments