|
@@ -42,10 +42,26 @@ class TestHandleConnectionErrors(object):
|
|
|
_, args, _ = mock_logging.error.mock_calls[0]
|
|
|
assert "Docker Engine of version 1.10.0 or greater" in args[0]
|
|
|
|
|
|
+ def test_api_error_version_mismatch_unicode_explanation(self, mock_logging):
|
|
|
+ with pytest.raises(errors.ConnectionError):
|
|
|
+ with handle_connection_errors(mock.Mock(api_version='1.22')):
|
|
|
+ raise APIError(None, None, u"client is newer than server")
|
|
|
+
|
|
|
+ _, args, _ = mock_logging.error.mock_calls[0]
|
|
|
+ assert "Docker Engine of version 1.10.0 or greater" in args[0]
|
|
|
+
|
|
|
def test_api_error_version_other(self, mock_logging):
|
|
|
msg = b"Something broke!"
|
|
|
with pytest.raises(errors.ConnectionError):
|
|
|
with handle_connection_errors(mock.Mock(api_version='1.22')):
|
|
|
raise APIError(None, None, msg)
|
|
|
|
|
|
+ mock_logging.error.assert_called_once_with(msg.decode('utf-8'))
|
|
|
+
|
|
|
+ def test_api_error_version_other_unicode_explanation(self, mock_logging):
|
|
|
+ msg = u"Something broke!"
|
|
|
+ with pytest.raises(errors.ConnectionError):
|
|
|
+ with handle_connection_errors(mock.Mock(api_version='1.22')):
|
|
|
+ raise APIError(None, None, msg)
|
|
|
+
|
|
|
mock_logging.error.assert_called_once_with(msg)
|