def test_encrypt_with_metadata_full_file_path(tmpdir):
plaintext_filename = 'source_plaintext'
plaintext_file = tmpdir.join(plaintext_filename)
plaintext_file.write_binary(os.urandom(1024))
plaintext_file_full_path = str(plaintext_file)
ciphertext_filename = 'ciphertext'
ciphertext_file = tmpdir.join(ciphertext_filename)
ciphertext_file_full_path = str(ciphertext_file)
metadata = tmpdir.join('metadata')
encrypt_args = encrypt_args_template(metadata=True).format(
source=plaintext_filename,
target=ciphertext_filename,
metadata='--metadata-output ' + str(metadata)
)
with tmpdir.as_cwd():
aws_encryption_sdk_cli.cli(shlex.split(encrypt_args, posix=not is_windows()))
raw_metadata = metadata.read()
output_metadata = json.loads(raw_metadata)
assert output_metadata['input'] == plaintext_file_full_path
assert output_metadata['output'] == ciphertext_file_full_path
test_i_aws_encryption_sdk_cli.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录