Fix compatibility to fetch_url change in ansible-core devel (#339)

* Fix compatibility to fetch_url change in ansible-core devel.

* Adjust tests.
This commit is contained in:
Felix Fontein
2021-11-17 21:26:49 +01:00
committed by GitHub
parent cf0d2679aa
commit 5de50b9f91
4 changed files with 23 additions and 5 deletions

View File

@@ -115,12 +115,14 @@ def test_format_error_problem(problem, subproblem_prefix, result):
def create_regular_response(response_text):
response = MagicMock()
response.read = MagicMock(return_value=response_text.encode('utf-8'))
response.closed = False
return response
def create_error_response():
response = MagicMock()
response.read = MagicMock(side_effect=AttributeError('read'))
response.closed = True
return response