summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/api_build_test.py15
-rw-r--r--tests/integration/api_image_test.py11
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/integration/api_build_test.py b/tests/integration/api_build_test.py
index 7cc3234..245214e 100644
--- a/tests/integration/api_build_test.py
+++ b/tests/integration/api_build_test.py
@@ -377,3 +377,18 @@ class BuildTest(BaseAPIIntegrationTest):
def test_build_gzip_custom_encoding(self):
with self.assertRaises(errors.DockerException):
self.client.build(path='.', gzip=True, encoding='text/html')
+
+ @requires_api_version('1.32')
+ @requires_experimental(until=None)
+ def test_build_invalid_platform(self):
+ script = io.BytesIO('FROM busybox\n'.encode('ascii'))
+
+ with pytest.raises(errors.APIError) as excinfo:
+ stream = self.client.build(
+ fileobj=script, stream=True, platform='foobar'
+ )
+ for _ in stream:
+ pass
+
+ assert excinfo.value.status_code == 400
+ assert 'invalid platform' in excinfo.exconly()
diff --git a/tests/integration/api_image_test.py b/tests/integration/api_image_test.py
index 14fb77a..178c34e 100644
--- a/tests/integration/api_image_test.py
+++ b/tests/integration/api_image_test.py
@@ -14,7 +14,7 @@ from six.moves import socketserver
import docker
-from ..helpers import requires_api_version
+from ..helpers import requires_api_version, requires_experimental
from .base import BaseAPIIntegrationTest, BUSYBOX
@@ -67,6 +67,15 @@ class PullImageTest(BaseAPIIntegrationTest):
img_info = self.client.inspect_image('hello-world')
self.assertIn('Id', img_info)
+ @requires_api_version('1.32')
+ @requires_experimental(until=None)
+ def test_pull_invalid_platform(self):
+ with pytest.raises(docker.errors.APIError) as excinfo:
+ self.client.pull('hello-world', platform='foobar')
+
+ assert excinfo.value.status_code == 500
+ assert 'invalid platform' in excinfo.exconly()
+
class CommitTest(BaseAPIIntegrationTest):
def test_commit(self):