@@ -389,6 +389,30 @@ def test_install_os_error(self, mock_wait, mock_reboot, mock_set_boot, mock_imag
389389 mock_raw_version_data .return_value = DEVICE_FACTS
390390 self .assertRaises (ios_module .OSInstallError , self .device .install_os , BOOT_IMAGE )
391391
392+ @mock .patch .object (IOSDevice , "os_version" , new_callable = mock .PropertyMock )
393+ @mock .patch .object (IOSDevice , "_image_booted" , side_effect = [False , True ])
394+ @mock .patch .object (IOSDevice , "set_boot_options" )
395+ @mock .patch .object (IOSDevice , "show" )
396+ @mock .patch .object (IOSDevice , "reboot" )
397+ @mock .patch .object (IOSDevice , "_wait_for_device_reboot" )
398+ @mock .patch .object (IOSDevice , "_raw_version_data" )
399+ def test_install_os_not_enough_space (
400+ self ,
401+ mock_raw_version_data ,
402+ mock_wait ,
403+ mock_reboot ,
404+ mock_show ,
405+ mock_set_boot ,
406+ mock_image_booted ,
407+ mock_os_version ,
408+ ):
409+ mock_raw_version_data .return_value = DEVICE_FACTS
410+ mock_os_version .return_value = "17.4.3"
411+ mock_show .return_value = "FAILED: There is not enough free disk available to perform this operation on switch 1. At least 1276287 KB of free disk is required"
412+ self .assertRaises (ios_module .OSInstallError , self .device .install_os , image_name = BOOT_IMAGE , install_mode = True )
413+ mock_wait .assert_not_called ()
414+ mock_reboot .assert_not_called ()
415+
392416
393417if __name__ == "__main__" :
394418 unittest .main ()
@@ -1262,6 +1286,7 @@ def test_install_os_install_mode_with_retries(
12621286 mock_has_reload_happened_recently .side_effect = [False , False , True ]
12631287 mock_image_booted .side_effect = [False , True ]
12641288 mock_sleep .return_value = None
1289+ mock_show .return_value = "show must go on"
12651290 # Call the install os function
12661291 actual = ios_device .install_os (image_name , install_mode = True )
12671292
0 commit comments