@@ -791,24 +791,24 @@ def test_get_file_system_raise_error(mock_hostname, ios_show):
791791 device .show .assert_has_calls ([mock .call ("dir" )] * 5 )
792792
793793
794- def test_send_command_error (ios_send_command ):
794+ def test_send_command_error (ios_native_send_command ):
795795 command = "send_command_error"
796- device = ios_send_command ([f"{ command } .txt" ])
796+ device = ios_native_send_command ([f"{ command } .txt" ])
797797 with pytest .raises (ios_module .CommandError ):
798798 device ._send_command (command )
799799 device .native .send_command .assert_called ()
800800
801801
802- def test_send_command_expect (ios_send_command ):
802+ def test_send_command_expect (ios_native_send_command ):
803803 command = "send_command_expect"
804- device = ios_send_command ([f"{ command } .txt" ])
804+ device = ios_native_send_command ([f"{ command } .txt" ])
805805 device ._send_command (command , expect_string = "Continue?" )
806806 device .native .send_command .assert_called_with (command_string = "send_command_expect" , expect_string = "Continue?" )
807807
808808
809- def test_send_command_timing (ios_send_command_timing ):
809+ def test_send_command_timing (ios_native_send_command_timing ):
810810 command = "send_command_timing"
811- device = ios_send_command_timing ([f"{ command } .txt" ])
811+ device = ios_native_send_command_timing ([f"{ command } .txt" ])
812812 device .native .send_command_timing (command )
813813 device .native .send_command_timing .assert_called ()
814814 device .native .send_command_timing .assert_called_with (command )
@@ -1197,13 +1197,52 @@ def test_show(ios_send_command):
11971197 command = "show_ip_arp"
11981198 device = ios_send_command ([f"{ command } .txt" ])
11991199 device .show (command )
1200- device .native .send_command .assert_called_with (command_string = "show_ip_arp" )
1201- device .native .send_command .assert_called_once ()
1200+ device ._send_command .assert_called_with (
1201+ "show_ip_arp" ,
1202+ expect_string = None ,
1203+ )
1204+ device ._send_command .assert_called_once ()
1205+
1206+
1207+ def test_show_expect (ios_send_command ):
1208+ command = "show_ip_arp"
1209+ expect = "this string"
1210+ device = ios_send_command ([f"{ command } .txt" ])
1211+ device .show (command , expect )
1212+ device ._send_command .assert_called_with (
1213+ "show_ip_arp" ,
1214+ expect_string = expect ,
1215+ )
1216+
1217+
1218+ def test_show_expect_netmiko_args (ios_send_command ):
1219+ command = "show_ip_arp"
1220+ expect = "this string"
1221+ netmiko_args = {"some_flag" : "passed" }
1222+ device = ios_send_command ([f"{ command } .txt" ])
1223+ device .show (command , expect , ** netmiko_args )
1224+ device ._send_command .assert_called_with (
1225+ "show_ip_arp" ,
1226+ expect_string = expect ,
1227+ ** netmiko_args ,
1228+ )
1229+
1230+
1231+ def test_show_netmiko_args (ios_send_command ):
1232+ command = "show_ip_arp"
1233+ netmiko_args = {"some_flag" : "passed" }
1234+ device = ios_send_command ([f"{ command } .txt" ])
1235+ device .show (command , ** netmiko_args )
1236+ device ._send_command .assert_called_with (
1237+ "show_ip_arp" ,
1238+ expect_string = None ,
1239+ ** netmiko_args ,
1240+ )
12021241
12031242
1204- def test_show_list (ios_send_command ):
1243+ def test_show_list (ios_native_send_command ):
12051244 commands = ["show_version" , "show_ip_arp" ]
1206- device = ios_send_command ([f"{ commands [0 ]} .txt" , f"{ commands [1 ]} " ])
1245+ device = ios_native_send_command ([f"{ commands [0 ]} .txt" , f"{ commands [1 ]} " ])
12071246 device .show_list (commands )
12081247 device .native .send_command .assert_has_calls (
12091248 [mock .call (command_string = "show_version" ), mock .call (command_string = "show_ip_arp" )]
@@ -1222,9 +1261,9 @@ def test_vlans(mock_show_vlan, mock_model, ios_show):
12221261
12231262@pytest .mark .parametrize ("show_boot_out" , (SHOW_BOOT_VARIABLE , SHOW_BOOT_PATH_LIST ), ids = ("bootvar" , "bootpath" ))
12241263@mock .patch .object (IOSDevice , "_get_file_system" , return_value = "flash:" )
1225- def test_boot_options_show_boot (mock_boot , show_boot_out , ios_send_command ):
1264+ def test_boot_options_show_boot (mock_boot , show_boot_out , ios_native_send_command ):
12261265 results = [ios_module .CommandError ("show bootvar" , "fail" ), show_boot_out ]
1227- device = ios_send_command (results )
1266+ device = ios_native_send_command (results )
12281267 boot_options = device .boot_options
12291268 assert boot_options == {"sys" : BOOT_IMAGE }
12301269 device .native .send_command .assert_called_with (command_string = "show boot" )
0 commit comments