@@ -2474,3 +2474,63 @@ def test_date_bad(self):
24742474 @classmethod
24752475 def teardown_class (cls ):
24762476 print ('TEARDOWN' )
2477+
2478+
2479+ class TestConfigBanner (object ):
2480+ @classmethod
2481+ def setup_class (cls ):
2482+ print ('SETUP' )
2483+ import config .main
2484+ importlib .reload (config .main )
2485+
2486+ @patch ('utilities_common.cli.run_command' ,
2487+ mock .MagicMock (side_effect = mock_run_command_side_effect ))
2488+ def test_banner_state (self ):
2489+ runner = CliRunner ()
2490+ obj = {'db' : Db ().cfgdb }
2491+
2492+ result = runner .invoke (
2493+ config .config .commands ['banner' ].commands ['state' ],
2494+ ['enabled' ], obj = obj )
2495+
2496+ assert result .exit_code == 0
2497+
2498+ @patch ('utilities_common.cli.run_command' ,
2499+ mock .MagicMock (side_effect = mock_run_command_side_effect ))
2500+ def test_banner_login (self ):
2501+ runner = CliRunner ()
2502+ obj = {'db' : Db ().cfgdb }
2503+
2504+ result = runner .invoke (
2505+ config .config .commands ['banner' ].commands ['login' ],
2506+ ['Login message' ], obj = obj )
2507+
2508+ assert result .exit_code == 0
2509+
2510+ @patch ('utilities_common.cli.run_command' ,
2511+ mock .MagicMock (side_effect = mock_run_command_side_effect ))
2512+ def test_banner_logout (self ):
2513+ runner = CliRunner ()
2514+ obj = {'db' : Db ().cfgdb }
2515+
2516+ result = runner .invoke (
2517+ config .config .commands ['banner' ].commands ['logout' ],
2518+ ['Logout message' ], obj = obj )
2519+
2520+ assert result .exit_code == 0
2521+
2522+ @patch ('utilities_common.cli.run_command' ,
2523+ mock .MagicMock (side_effect = mock_run_command_side_effect ))
2524+ def test_banner_motd (self ):
2525+ runner = CliRunner ()
2526+ obj = {'db' : Db ().cfgdb }
2527+
2528+ result = runner .invoke (
2529+ config .config .commands ['banner' ].commands ['motd' ],
2530+ ['Motd message' ], obj = obj )
2531+
2532+ assert result .exit_code == 0
2533+
2534+ @classmethod
2535+ def teardown_class (cls ):
2536+ print ('TEARDOWN' )
0 commit comments