MCPcopy
hub / github.com/aws/aws-cli / test_invalid_output_encoding_throws

Method test_invalid_output_encoding_throws

tests/unit/test_clidriver.py:394–407  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

decodeMethod · 0.80
mainMethod · 0.45
flushMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected