combox

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

commit 24eb6541326111f58b750f5be116dc66ce072bd5
parent 27e46c36acb6a8465af4c20812c8a8ed7c61d5ba
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Wed, 28 Jan 2015 11:21:49 -0500

tests/events_test.py: wrote test for 'file modification' under test_housekeep()

This, I guess, completes the tests for the new housekeep method in the ComboxDirMonitor class.

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

diff --git a/tests/events_test.py b/tests/events_test.py @@ -245,6 +245,8 @@ def test_CDM(): def test_housekeep(): """ComboxDirMonitor's housekeep method test.""" + # test file deletion and addition + lorem = path.join(FILES_DIR, 'lorem.txt') lorem_moved = path.join(FILES_DIR, 'lorem.moved.txt') os.rename(lorem, lorem_moved) @@ -260,3 +262,29 @@ def test_housekeep(): os.rename(lorem_moved, lorem) rm_shards(lorem_moved, config) silo.remove(lorem_moved) + + # test file modification + + lorem_ipsum = path.join(FILES_DIR, 'lorem.ipsum.txt') + copyfile(lorem, lorem_ipsum) + assert path.exists(lorem_ipsum) + + cdm = ComboxDirMonitor(config) + cdm.housekeep() + + silo = ComboxSilo(config) + assert silo.exists(lorem_ipsum) + + ipsum = path.join(FILES_DIR, "ipsum.txt") + ipsum_content = read_file(ipsum) + + lorem_ipsum_content = read_file(lorem_ipsum) + lorem_ipsum_content = "%s\n%s" % (lorem_ipsum_content, ipsum_content) + write_file(lorem_ipsum, lorem_ipsum_content) + + cdm.housekeep() + + silo = ComboxSilo(config) + assert not silo.stale(lorem_ipsum) + os.remove(lorem_ipsum) + silo.remove(lorem_ipsum)