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