summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Firshman <ben@firshman.co.uk>2016-12-01 11:11:46 +0000
committerGitHub <noreply@github.com>2016-12-01 11:11:46 +0000
commite7d78d10f628409f80453bbd94ef37410b49186d (patch)
treec8ac6b07140b6daa3e3a7b2b37023bbefae05c1a /tests
parent239673a51c16715e401f02c9912b6a1a8619188b (diff)
parent8c27dd52335c55055a0e565ea4421d4e7c5ffdfb (diff)
downloaddocker-py-e7d78d10f628409f80453bbd94ef37410b49186d.tar.gz
Merge pull request #1303 from aanand/helpful-containers-warning
Show a helpful warning when people try to call `client.containers()`
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/client_test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/client_test.py b/tests/unit/client_test.py
index aff6973..716827a 100644
--- a/tests/unit/client_test.py
+++ b/tests/unit/client_test.py
@@ -1,5 +1,6 @@
import datetime
import docker
+from docker.utils import kwargs_from_env
import os
import unittest
@@ -59,6 +60,16 @@ class ClientTest(unittest.TestCase):
assert "'DockerClient' object has no attribute 'abcdef'" in s
assert "this method is now on the object APIClient" not in s
+ def test_call_containers(self):
+ client = docker.Client(**kwargs_from_env())
+
+ with self.assertRaises(TypeError) as cm:
+ client.containers()
+
+ s = str(cm.exception)
+ assert "'ContainerCollection' object is not callable" in s
+ assert "docker.APIClient" in s
+
class FromEnvTest(unittest.TestCase):