def test_file_to_dir_cycle(tmpdir):
inner_dir = tmpdir.mkdir('inner')
plaintext = tmpdir.join('source_plaintext')
ciphertext = inner_dir.join('source_plaintext.encrypted')
decrypted = tmpdir.join('decrypted')
with open(str(plaintext), 'wb') as f:
f.write(os.urandom(1024))
encrypt_args = encrypt_args_template().format(
source=str(plaintext),
target=str(inner_dir)
)
decrypt_args = decrypt_args_template().format(
source=str(ciphertext),
target=str(decrypted)
)
aws_encryption_sdk_cli.cli(shlex.split(encrypt_args, posix=not is_windows()))
assert os.path.isfile(str(ciphertext))
aws_encryption_sdk_cli.cli(shlex.split(decrypt_args, posix=not is_windows()))
assert filecmp.cmp(str(plaintext), str(decrypted))
test_i_aws_encryption_sdk_cli.py 文件源码
python
阅读 35
收藏 0
点赞 0
评论 0
评论列表
文章目录