diff options
Diffstat (limited to 'test/units/galaxy/test_api.py')
-rw-r--r-- | test/units/galaxy/test_api.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/units/galaxy/test_api.py b/test/units/galaxy/test_api.py index b94bbb1f25..a6c62328cc 100644 --- a/test/units/galaxy/test_api.py +++ b/test/units/galaxy/test_api.py @@ -23,7 +23,7 @@ from ansible.galaxy import api as galaxy_api from ansible.galaxy.api import CollectionVersionMetadata, GalaxyAPI, GalaxyError from ansible.galaxy.token import BasicAuthToken, GalaxyToken, KeycloakToken from ansible.module_utils.common.text.converters import to_native, to_text -from ansible.module_utils.six.moves.urllib import error as urllib_error +import urllib.error from ansible.utils import context_objects as co from ansible.utils.display import Display @@ -324,8 +324,8 @@ def test_initialise_automation_hub(monkeypatch): def test_initialise_unknown(monkeypatch): mock_open = MagicMock() mock_open.side_effect = [ - urllib_error.HTTPError('https://galaxy.ansible.com/api/', 500, 'msg', {}, StringIO(u'{"msg":"raw error"}')), - urllib_error.HTTPError('https://galaxy.ansible.com/api/api/', 500, 'msg', {}, StringIO(u'{"msg":"raw error"}')), + urllib.error.HTTPError('https://galaxy.ansible.com/api/', 500, 'msg', {}, StringIO(u'{"msg":"raw error"}')), + urllib.error.HTTPError('https://galaxy.ansible.com/api/api/', 500, 'msg', {}, StringIO(u'{"msg":"raw error"}')), ] monkeypatch.setattr(galaxy_api, 'open_url', mock_open) @@ -442,7 +442,7 @@ def test_publish_failure(api_version, collection_url, response, expected, collec expected_url = '%s/api/%s/%s' % (api.api_server, api_version, collection_url) mock_open = MagicMock() - mock_open.side_effect = urllib_error.HTTPError(expected_url, 500, 'msg', {}, + mock_open.side_effect = urllib.error.HTTPError(expected_url, 500, 'msg', {}, StringIO(to_text(json.dumps(response)))) monkeypatch.setattr(galaxy_api, 'open_url', mock_open) @@ -1234,7 +1234,7 @@ def test_cache_flaky_pagination(cache_dir, monkeypatch): side_effect=[ StringIO(to_text(json.dumps(responses[0]))), StringIO(to_text(json.dumps(responses[1]))), - urllib_error.HTTPError(responses[1]['next'], 500, 'Error', {}, StringIO()), + urllib.error.HTTPError(responses[1]['next'], 500, 'Error', {}, StringIO()), StringIO(to_text(json.dumps(responses[3]))), ] ) |