From 724aecf9a02e8d36847748d55b2854eefc44f6f7 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Thu, 11 Sep 2025 13:01:45 -0500 Subject: [PATCH] fix up test --- test/units/galaxy/test_collection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/units/galaxy/test_collection.py b/test/units/galaxy/test_collection.py index 7115a1da44f..af95468706d 100644 --- a/test/units/galaxy/test_collection.py +++ b/test/units/galaxy/test_collection.py @@ -919,10 +919,12 @@ def test_download_file_hash_mismatch(tmp_path_factory, monkeypatch): data = b"\x00\x01\x02\x03" mock_open = MagicMock() - mock_open.return_value = BytesIO(data) + mock_open.return_value = resp = MagicMock() + resp.read = BytesIO(data).read + resp.headers = {'content-length': f'{len(data)}'} monkeypatch.setattr(collection.concrete_artifact_manager, 'open_url', mock_open) - expected = "Mismatch artifact hash with downloaded file" + expected = "Mismatched artifact hash with downloaded file of 4 bytes." with pytest.raises(AnsibleError, match=expected): collection._download_file('http://google.com/file', temp_dir, 'bad', True)