From 0a17d0e3208d0392cc7a8234515544553a1726a5 Mon Sep 17 00:00:00 2001 From: Guilherme Gallo Date: Sun, 12 Mar 2023 16:31:17 -0300 Subject: [PATCH] framework/replay: Update simpler integrity unit tests Make them check if we removed wrong local file or not. Reviewed-by: Guilherme Gallo Part-of: --- unittests/framework/replay/test_download_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittests/framework/replay/test_download_utils.py b/unittests/framework/replay/test_download_utils.py index 0fa5dd3b1..565242504 100644 --- a/unittests/framework/replay/test_download_utils.py +++ b/unittests/framework/replay/test_download_utils.py @@ -219,6 +219,7 @@ class TestDownloadUtils(object): @pytest.mark.raises(exception=exceptions.PiglitFatalError) def test_download_with_invalid_content_length(self, + mocker, requests_mock, prepare_trace_file): """download_utils.download: Check if an exception raises @@ -230,7 +231,10 @@ class TestDownloadUtils(object): text="Binary file content") assert not self.trace_file.check() - download_utils.download(self.full_url, self.trace_file, None) + with mocker.patch('os.remove') as mock_remove: + download_utils.download(self.full_url, self.trace_file, None) + mock_remove.assert_called_once_with(self.trace_file) + def test_download_works_at_last_retry(self, requests_mock, -- 2.11.4.GIT