combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit 02d16c4cc9abfe92e8a2827a7cd4bb26c7b6a679
parent a2c64aa2d051a4392fe9490d61fa31640139afd1
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Tue, 13 Jan 2015 23:29:41 -0500

tests/crypto_test.py: added new test function to test split_and_encrypt and decrypt_and_glue functions.

Diffstat:
tests/crypto_test.py | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/tests/crypto_test.py b/tests/crypto_test.py @@ -18,9 +18,11 @@ import yaml +from filecmp import cmp from glob import glob from nose.tools import * from os import path, remove +from shutil import copyfile from combox.config import get_nodedirs from combox.crypto import * @@ -86,3 +88,22 @@ def test_split_encryption(): f_content_glued = glue_data(f_parts) assert f_content == f_content_glued + +def test_convenience_crypto(): + """ + Tests convenience crypto function(s) - split_and_encrypt, decrypt and glue. + """ + + # splits file into shards, writes encrypted shards to respective + # node directories. + split_and_encrypt(TEST_FILE, config) + + # create a copy of TEST_FILE (for later comparision) + TEST_FILE_COPY = "%s.copy" % TEST_FILE + copyfile(TEST_FILE, TEST_FILE_COPY) + + # reads encrypted shards from node directories, glues them and + # writes decrypted back to combox directory. + decrypt_and_glue(TEST_FILE, config) + + assert cmp(TEST_FILE, TEST_FILE_COPY, False)