fix up test

pull/85846/head
Matt Martz 3 months ago
parent 17f4b3a00b
commit 724aecf9a0
No known key found for this signature in database
GPG Key ID: 40832D88E9FC91D8

@ -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)

Loading…
Cancel
Save