mirror of
				https://github.com/Telecominfraproject/ols-nos.git
				synced 2025-10-31 10:07:49 +00:00 
			
		
		
		
	 6370257fa3
			
		
	
	6370257fa3
	
	
	
		
			
			This PR is to add the following Add a new options "--profile" to the show macsec command, to show all profiles in device Update the currentl show macsec command, to show profile in each interface o/p. This will tell which macsec profile the interface is attached to.
		
			
				
	
	
		
			30 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| import sys
 | |
| from unittest import mock
 | |
| 
 | |
| from click.testing import CliRunner
 | |
| 
 | |
| sys.path.append('../cli/show/plugins/')
 | |
| import show_macsec
 | |
| 
 | |
| 
 | |
| class TestShowMACsec(object):
 | |
|     def test_plugin_registration(self):
 | |
|         cli = mock.MagicMock()
 | |
|         show_macsec.register(cli)
 | |
|         cli.add_command.assert_called_once_with(show_macsec.macsec)
 | |
| 
 | |
|     def test_show_all(self):
 | |
|         runner = CliRunner()
 | |
|         result = runner.invoke(show_macsec.macsec,[])
 | |
|         assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
 | |
| 
 | |
|     def test_show_one_port(self):
 | |
|         runner = CliRunner()
 | |
|         result = runner.invoke(show_macsec.macsec,["Ethernet1"])
 | |
|         assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
 | |
| 
 | |
|     def test_show_profile(self):
 | |
|         runner = CliRunner()
 | |
|         result = runner.invoke(show_macsec.macsec,["--profile"])
 | |
|         assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
 |