예제 #1
0
 def test1_finish(self):
     mock_finish_function = MagicMock()
     download = Download("test_url",
                         "test_save_location",
                         finish_func=mock_finish_function)
     download.finish()
     exp = 2
     obs = len(mock_finish_function.mock_calls)
     self.assertEqual(exp, obs)
예제 #2
0
 def test2_finish(self):
     mock_finish_function = MagicMock()
     mock_finish_function.side_effect = FileNotFoundError(
         Mock(status="Connection Error"))
     mock_cancel_function = MagicMock()
     download = Download("test_url",
                         "test_save_location",
                         finish_func=mock_finish_function,
                         cancel_func=mock_cancel_function)
     download.finish()
     exp = 2
     obs = len(mock_cancel_function.mock_calls)
     self.assertEqual(exp, obs)