| 442 | @requires_api_version('1.32') |
| 443 | @requires_experimental(until=None) |
| 444 | def test_build_invalid_platform(self): |
| 445 | script = io.BytesIO(b'FROM busybox\n') |
| 446 | |
| 447 | with pytest.raises(errors.APIError) as excinfo: |
| 448 | stream = self.client.build(fileobj=script, platform='foobar') |
| 449 | for _ in stream: |
| 450 | pass |
| 451 | |
| 452 | # Some API versions incorrectly returns 500 status; assert 4xx or 5xx |
| 453 | assert excinfo.value.is_error() |
| 454 | assert 'unknown operating system' in excinfo.exconly() \ |
| 455 | or 'invalid platform' in excinfo.exconly() |
| 456 | |
| 457 | def test_build_out_of_context_dockerfile(self): |
| 458 | base_dir = tempfile.mkdtemp() |