def test1_set_progress(self): mock_progress_function = MagicMock() download = Download("test_url", "test_save_location", progress_func=mock_progress_function) download.set_progress(50) kall = mock_progress_function.mock_calls[-1] name, args, kwargs = kall exp = 50 obs = args[0] self.assertEqual(exp, obs)
def test2_set_progress(self): mock_progress_function = MagicMock() download = Download("test_url", "test_save_location", progress_func=mock_progress_function, out_of_amount=2) download.set_progress(32) kall = mock_progress_function.mock_calls[-1] name, args, kwargs = kall exp = 16 obs = args[0] self.assertEqual(exp, obs)