summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-03-23 11:20:07 -0700
committerJoffrey F <joffrey@docker.com>2016-03-23 11:23:05 -0700
commitec05d5d2c0dcb4b864fcc186ea4081ebfc6e8f5c (patch)
tree39cc7644d5df699c636a21b1365a7af0e60828b8
parenta67f4c1ecce1024d158c687e304f623017341b58 (diff)
downloaddocker-py-ec05d5d2c0dcb4b864fcc186ea4081ebfc6e8f5c.tar.gz
gzip build testspeedplane-patch-1
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r--tests/integration/build_test.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/integration/build_test.py b/tests/integration/build_test.py
index 26164ae..cc8a862 100644
--- a/tests/integration/build_test.py
+++ b/tests/integration/build_test.py
@@ -6,6 +6,8 @@ import tempfile
import six
+from docker import errors
+
from .. import helpers
from ..base import requires_api_version
@@ -138,3 +140,29 @@ class BuildTest(helpers.BaseTestCase):
control_chars[0], control_chars[1], snippet
)
self.assertTrue(any([line == expected for line in lines]))
+
+ def test_build_gzip_encoding(self):
+ base_dir = tempfile.mkdtemp()
+ self.addCleanup(shutil.rmtree, base_dir)
+
+ with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
+ f.write("\n".join([
+ 'FROM busybox',
+ 'MAINTAINER docker-py',
+ 'ADD . /test',
+ ]))
+
+ stream = self.client.build(
+ path=base_dir, stream=True, decode=True, nocache=True,
+ gzip=True
+ )
+
+ lines = []
+ for chunk in stream:
+ lines.append(chunk)
+
+ assert 'Successfully built' in lines[-1]['stream']
+
+ def test_build_gzip_custom_encoding(self):
+ with self.assertRaises(errors.DockerException):
+ self.client.build(path='.', gzip=True, encoding='text/html')