combox

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

commit d15e4f7cbf9b3eb6b7b350a45b336eb5a327f6d0
parent c04f52356574387c133635025fe8f65127d79427
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Thu, 15 Jan 2015 17:28:39 -0500

tests/events_test.py: wrote code to test whether files created in a nested directory properly are split properly to node dirs.

Diffstat:
tests/events_test.py | 22+++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/tests/events_test.py b/tests/events_test.py @@ -29,7 +29,7 @@ from watchdog.observers import Observer from combox.events import ComboxEventHandler from combox.config import get_nodedirs -from combox.file import relative_path +from combox.file import relative_path, purge_dir CONFIG_DIR = path.join('tests', 'test-config') @@ -77,14 +77,14 @@ def test_CEH(): observer.start() # Test - new file addition - TEST_FILE_COPY = "%s.mutant" % TEST_FILE - copyfile(TEST_FILE, TEST_FILE_COPY) + TEST_FILE_COPY_0 = "%s.mutant" % TEST_FILE + copyfile(TEST_FILE, TEST_FILE_COPY_0) ## wait for ComboxEventHandler to split and scatter the file in the ## node directories. time.sleep(1) ## check if the shards were created. - shardedp(TEST_FILE_COPY) - remove(TEST_FILE_COPY) + shardedp(TEST_FILE_COPY_0) + remove(TEST_FILE_COPY_0) # Test - directory creation TEST_DIR_0 = path.join(FILES_DIR, 'foo') @@ -99,5 +99,17 @@ def test_CEH(): ## check if TEST_DIR_1 is created under node directories. dirp(TEST_DIR_1) + # Test - new file in a nested directory + TEST_FILE_COPY_1 = path.join(TEST_DIR_1, path.basename(TEST_FILE)) + copyfile(TEST_FILE, TEST_FILE_COPY_1) + time.sleep(1) + shardedp(TEST_FILE_COPY_1) + remove(TEST_FILE_COPY_1) + # purge nested dir TEST_DIR_0 + purge_dir(TEST_DIR_0) + # remove the directory itself. + os.rmdir(TEST_DIR_0) + time.sleep(2) + observer.stop() observer.join()