def test_wrong_password(tmp_file_path):
"""
Test the initialization of a CryptoStash (When stash file doesn't exist)
"""
# Initialization:
cs = CryptoStash(tmp_file_path,'my_password',default_num_iterations=1000)
my_store = {'1':2, '3':4}
cs.write_store({1:2,3:4})
# Try to load Crypto Stash with the wrong password:
with pytest.raises(SSCryptoError):
cs = CryptoStash(tmp_file_path,'my_password2',
default_num_iterations=1000)
# Try to load Crypto Stash with the correct password.
# Should work correctly:
cs = CryptoStash(tmp_file_path,'my_password',default_num_iterations=1000)
cs.read_store()
评论列表
文章目录