diff --git a/docker/api/container.py b/docker/api/container.py index 9a25b21489..40607e79a3 100644 --- a/docker/api/container.py +++ b/docker/api/container.py @@ -678,7 +678,8 @@ def diff(self, container): container (str): The container to diff Returns: - (str) + (list) A list of dictionaries containing the attributes `Path` + and `Kind`. Raises: :py:class:`docker.errors.APIError` @@ -1163,8 +1164,9 @@ def stats(self, container, decode=None, stream=True, one_shot=None): 'one_shot is only available in conjunction with ' 'stream=False' ) - return self._stream_helper(self._get(url, params=params), - decode=decode) + return self._stream_helper( + self._get(url, stream=True, params=params), decode=decode + ) else: if decode: raise errors.InvalidArgument( diff --git a/docker/models/containers.py b/docker/models/containers.py index f451cf3fe7..2eeefda1ee 100644 --- a/docker/models/containers.py +++ b/docker/models/containers.py @@ -141,7 +141,8 @@ def diff(self): Inspect changes on a container's filesystem. Returns: - (str) + (list) A list of dictionaries containing the attributes `Path` + and `Kind`. Raises: :py:class:`docker.errors.APIError` diff --git a/tests/unit/api_container_test.py b/tests/unit/api_container_test.py index c605da371c..c4e2250be0 100644 --- a/tests/unit/api_container_test.py +++ b/tests/unit/api_container_test.py @@ -1528,10 +1528,21 @@ def test_container_stats(self): fake_request.assert_called_with( 'GET', url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/stats', + stream=True, timeout=60, params={'stream': True} ) + def test_container_stats_without_streaming(self): + self.client.stats(fake_api.FAKE_CONTAINER_ID, stream=False) + + fake_request.assert_called_with( + 'GET', + url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/stats', + timeout=60, + params={'stream': False} + ) + def test_container_stats_with_one_shot(self): self.client.stats( fake_api.FAKE_CONTAINER_ID, stream=False, one_shot=True)