mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Fixing HTTPError case of fetch_url for Python 3 compatibility. (#45628)
* Fixing HTTPError case of fetch_url for Python 3 compatibility. * Adding unit test. * PEP8. * Changelog.
This commit is contained in:
committed by
Matt Martz
parent
d34cf93f1a
commit
bc69aeca7f
@@ -178,13 +178,14 @@ def test_fetch_url_httperror(open_url_mock, fake_ansible_module):
|
||||
'http://ansible.com/',
|
||||
500,
|
||||
'Internal Server Error',
|
||||
{},
|
||||
{'Content-Type': 'application/json'},
|
||||
StringIO('TESTS')
|
||||
)
|
||||
|
||||
r, info = fetch_url(fake_ansible_module, 'http://ansible.com/')
|
||||
|
||||
assert info == {'msg': 'HTTP Error 500: Internal Server Error', 'body': 'TESTS', 'status': 500, 'url': 'http://ansible.com/'}
|
||||
assert info == {'msg': 'HTTP Error 500: Internal Server Error', 'body': 'TESTS',
|
||||
'status': 500, 'url': 'http://ansible.com/', 'content-type': 'application/json'}
|
||||
|
||||
|
||||
def test_fetch_url_urlerror(open_url_mock, fake_ansible_module):
|
||||
|
||||
Reference in New Issue
Block a user