| 392 | assert stderr_b.getvalue().strip() == "aws: [ERROR]: ☃".encode() |
| 393 | |
| 394 | def test_invalid_output_encoding_throws(self): |
| 395 | stderr_b = io.BytesIO() |
| 396 | fake_stderr = io.TextIOWrapper(stderr_b) |
| 397 | with mock.patch.dict( |
| 398 | os.environ, {'AWS_CLI_OUTPUT_ENCODING': 'invalid'} |
| 399 | ): |
| 400 | with contextlib.redirect_stderr(fake_stderr): |
| 401 | rc = self.driver.main('s3 list-objects --bucket foo'.split()) |
| 402 | assert rc == 255 |
| 403 | fake_stderr.flush() |
| 404 | assert ( |
| 405 | stderr_b.getvalue().decode().strip() |
| 406 | == 'aws: [ERROR]: Unknown codec `invalid` specified for AWS_CLI_OUTPUT_ENCODING.' |
| 407 | ) |
| 408 | |
| 409 | def test_can_access_subcommand_table(self): |
| 410 | table = self.driver.subcommand_table |