Merge "use HTTPStatus instead of http.client"
This commit is contained in:
commit
49e7a14d39
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from http import client as http_client
|
import http
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
import json
|
import json
|
||||||
@ -78,10 +78,12 @@ class FakeSwiftConnection(object):
|
|||||||
LOG.debug("fake head_container(%s)", container)
|
LOG.debug("fake head_container(%s)", container)
|
||||||
if container == 'missing_container':
|
if container == 'missing_container':
|
||||||
raise swift.ClientException('fake exception',
|
raise swift.ClientException('fake exception',
|
||||||
http_status=http_client.NOT_FOUND)
|
http_status=http.HTTPStatus.NOT_FOUND)
|
||||||
elif container == 'unauthorized_container':
|
elif container == 'unauthorized_container':
|
||||||
raise swift.ClientException('fake exception',
|
raise swift.ClientException(
|
||||||
http_status=http_client.UNAUTHORIZED)
|
'fake exception',
|
||||||
|
http_status=http.HTTPStatus.UNAUTHORIZED
|
||||||
|
)
|
||||||
elif container == 'socket_error_on_head':
|
elif container == 'socket_error_on_head':
|
||||||
raise socket.error(111, 'ECONNREFUSED')
|
raise socket.error(111, 'ECONNREFUSED')
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user