From c1a722d771ad107de57abf4de76bc8bc18c346f7 Mon Sep 17 00:00:00 2001 From: likui Date: Wed, 11 Nov 2020 09:30:06 +0800 Subject: use HTTPStatus instead of http.client We don't need an HTTP client for this, we only need status codes. Just load that instead. https://docs.python.org/3/library/http.html Change-Id: I2be70b395877ede3f594232a19cab4b83835dcc5 --- trove/tests/fakes/swift.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/trove/tests/fakes/swift.py b/trove/tests/fakes/swift.py index acc1a46b..bd2da58e 100644 --- a/trove/tests/fakes/swift.py +++ b/trove/tests/fakes/swift.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from http import client as http_client +import http from hashlib import md5 from unittest.mock import MagicMock, patch import json @@ -78,10 +78,12 @@ class FakeSwiftConnection(object): LOG.debug("fake head_container(%s)", container) if container == 'missing_container': raise swift.ClientException('fake exception', - http_status=http_client.NOT_FOUND) + http_status=http.HTTPStatus.NOT_FOUND) elif container == 'unauthorized_container': - raise swift.ClientException('fake exception', - http_status=http_client.UNAUTHORIZED) + raise swift.ClientException( + 'fake exception', + http_status=http.HTTPStatus.UNAUTHORIZED + ) elif container == 'socket_error_on_head': raise socket.error(111, 'ECONNREFUSED') pass -- cgit v1.2.1