Kaydet (Commit) 599aa1a8 authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #1536 from docker/2.2.1-release

2.2.1 release
......@@ -68,9 +68,10 @@ class DaemonApiMixin(object):
'until': until,
'filters': filters
}
url = self._url('/events')
return self._stream_helper(
self._get(self._url('/events'), params=params, stream=True),
self._get(url, params=params, stream=True, timeout=None),
decode=decode
)
......
......@@ -59,7 +59,7 @@ class APIError(requests.exceptions.HTTPError, DockerException):
@property
def status_code(self):
if self.response:
if self.response is not None:
return self.response.status_code
def is_client_error(self):
......
version = "2.2.0"
version = "2.2.1"
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])
Change log
==========
2.2.1
-----
[List of PRs / issues for this release](https://github.com/docker/docker-py/milestone/32?closed=1)
### Bugfixes
* Fixed a bug where the `status_code` attribute of `APIError` exceptions would
not reflect the expected value.
* Fixed an issue where the `events` method would time out unexpectedly if no
data was sent by the engine for a given amount of time.
2.2.0
-----
......
......@@ -40,6 +40,7 @@ Container objects
.. automethod:: logs
.. automethod:: pause
.. automethod:: put_archive
.. automethod:: reload
.. automethod:: remove
.. automethod:: rename
.. automethod:: resize
......
......@@ -26,4 +26,5 @@ Secret objects
The raw representation of this object from the server.
.. automethod:: reload
.. automethod:: remove
......@@ -363,7 +363,7 @@ class ServiceTest(BaseAPIIntegrationTest):
self.tmp_secrets.append(secret_id)
secret_ref = docker.types.SecretReference(secret_id, secret_name)
container_spec = docker.types.ContainerSpec(
'busybox', ['top'], secrets=[secret_ref]
'busybox', ['sleep', '999'], secrets=[secret_ref]
)
task_tmpl = docker.types.TaskTemplate(container_spec)
name = self.get_service_name()
......@@ -388,7 +388,7 @@ class ServiceTest(BaseAPIIntegrationTest):
self.tmp_secrets.append(secret_id)
secret_ref = docker.types.SecretReference(secret_id, secret_name)
container_spec = docker.types.ContainerSpec(
'busybox', ['top'], secrets=[secret_ref]
'busybox', ['sleep', '999'], secrets=[secret_ref]
)
task_tmpl = docker.types.TaskTemplate(container_spec)
name = self.get_service_name()
......
......@@ -229,7 +229,7 @@ class DockerApiTest(BaseAPIClientTest):
url_prefix + 'events',
params={'since': None, 'until': None, 'filters': None},
stream=True,
timeout=DEFAULT_TIMEOUT_SECONDS
timeout=None
)
def test_events_with_since_until(self):
......@@ -249,7 +249,7 @@ class DockerApiTest(BaseAPIClientTest):
'filters': None
},
stream=True,
timeout=DEFAULT_TIMEOUT_SECONDS
timeout=None
)
def test_events_with_filters(self):
......@@ -268,7 +268,7 @@ class DockerApiTest(BaseAPIClientTest):
'filters': expected_filters
},
stream=True,
timeout=DEFAULT_TIMEOUT_SECONDS
timeout=None
)
def _socket_path_for_client_session(self, client):
......
import unittest
import requests
from docker.errors import (APIError, DockerException,
create_unexpected_kwargs_error)
......@@ -11,6 +13,69 @@ class APIErrorTest(unittest.TestCase):
except DockerException:
pass
def test_status_code_200(self):
"""The status_code property is present with 200 response."""
resp = requests.Response()
resp.status_code = 200
err = APIError('', response=resp)
assert err.status_code == 200
def test_status_code_400(self):
"""The status_code property is present with 400 response."""
resp = requests.Response()
resp.status_code = 400
err = APIError('', response=resp)
assert err.status_code == 400
def test_status_code_500(self):
"""The status_code property is present with 500 response."""
resp = requests.Response()
resp.status_code = 500
err = APIError('', response=resp)
assert err.status_code == 500
def test_is_server_error_200(self):
"""Report not server error on 200 response."""
resp = requests.Response()
resp.status_code = 200
err = APIError('', response=resp)
assert err.is_server_error() is False
def test_is_server_error_300(self):
"""Report not server error on 300 response."""
resp = requests.Response()
resp.status_code = 300
err = APIError('', response=resp)
assert err.is_server_error() is False
def test_is_server_error_400(self):
"""Report not server error on 400 response."""
resp = requests.Response()
resp.status_code = 400
err = APIError('', response=resp)
assert err.is_server_error() is False
def test_is_server_error_500(self):
"""Report server error on 500 response."""
resp = requests.Response()
resp.status_code = 500
err = APIError('', response=resp)
assert err.is_server_error() is True
def test_is_client_error_500(self):
"""Report not client error on 500 response."""
resp = requests.Response()
resp.status_code = 500
err = APIError('', response=resp)
assert err.is_client_error() is False
def test_is_client_error_400(self):
"""Report client error on 400 response."""
resp = requests.Response()
resp.status_code = 400
err = APIError('', response=resp)
assert err.is_client_error() is True
class CreateUnexpectedKwargsErrorTest(unittest.TestCase):
def test_create_unexpected_kwargs_error_single(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment