summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-02-26 22:44:58 -0500
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-02-26 22:44:58 -0500
commit1217539f47c923a22434e05eaa9e271696c6a637 (patch)
tree7ee3a220a29108bd716837bf780bdf95ff73594f /tests
parent65bd4237e892441a6e143b7d8b7b7a3541118850 (diff)
fleshed out the NodeDirMonitor's on_modified method + wrote tests for it.
modified: combox/events.py modified: tests/events_test.py
Diffstat (limited to 'tests')
-rw-r--r--tests/events_test.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/events_test.py b/tests/events_test.py
index c62d3f2..f645e75 100644
--- a/tests/events_test.py
+++ b/tests/events_test.py
@@ -266,6 +266,40 @@ class TestEvents(object):
self.purge_list.append(self.TEST_FILE_MUTANT)
self.purge_list.append(self.FOO_DIR)
+ # Test - shard modification
+ self.lorem_file = path.join(self.FILES_DIR, 'lorem.txt')
+ lorem_content = read_file(self.lorem_file)
+ self.lorem_file_copy = "%s.copy" % self.lorem_file
+
+ copyfile(self.lorem_file, self.lorem_file_copy)
+ split_and_encrypt(self.lorem_file_copy, self.config,
+ lorem_content)
+
+ silo = ComboxSilo(self.config)
+ silo.update(self.lorem_file_copy)
+ shardedp(self.lorem_file_copy)
+
+ silo = ComboxSilo(self.config)
+ lorem_file_copy_hash = silo.db.get(self.lorem_file_copy)
+
+ self.ipsum_file = path.join(self.FILES_DIR, 'ipsum.txt')
+ ipsum_content = read_file(self.ipsum_file)
+ lorem_copy_content = "%s\n%s" % (lorem_content, ipsum_content)
+
+ split_and_encrypt(self.lorem_file_copy, self.config,
+ lorem_copy_content)
+ time.sleep(1)
+ ## check if the lorem_file_copy's info is updated in silo
+ silo = ComboxSilo(self.config)
+
+ assert lorem_copy_content == read_file(self.lorem_file_copy)
+ assert lorem_file_copy_hash != silo.db.get(self.lorem_file_copy)
+
+ self.purge_list.append(self.lorem_file_copy)
+
+ observer.stop()
+ observer.join()
+
def teardown(self):
"""Cleans up things after each test in this class"""