def test_encrypt_with_metadata_output_write_to_stdout(tmpdir, capsys):
plaintext = tmpdir.join('source_plaintext')
plaintext.write_binary(os.urandom(1024))
ciphertext = tmpdir.join('ciphertext')
encrypt_args = encrypt_args_template(metadata=True).format(
source=str(plaintext),
target=str(ciphertext),
metadata='--metadata-output -'
)
aws_encryption_sdk_cli.cli(shlex.split(encrypt_args, posix=not is_windows()))
out, _err = capsys.readouterr()
output_metadata = json.loads(out)
for key, value in (('a', 'b'), ('c', 'd')):
assert output_metadata['header']['encryption_context'][key] == value
assert output_metadata['mode'] == 'encrypt'
assert output_metadata['input'] == str(plaintext)
assert output_metadata['output'] == str(ciphertext)
test_i_aws_encryption_sdk_cli.py 文件源码
python
阅读 37
收藏 0
点赞 0
评论 0
评论列表
文章目录