combox

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

commit 1f91f748cb2ff193011aaab714442298a231aa10
parent 27acc86045b457bd800b5203d97218c0197bfeea
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Fri, 13 Mar 2015 12:03:20 -0400

Added `shardp' method to combox.events.NodeDirMonitor + test for it.

	modified:   combox/events.py
	modified:   tests/events_test.py

Diffstat:
combox/events.py | 11+++++++++++
tests/events_test.py | 10++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/combox/events.py b/combox/events.py @@ -202,6 +202,17 @@ class NodeDirMonitor(LoggingEventHandler): self.silo = ComboxSilo(self.config) + def shardp(self, path): + """Returns True if `path' is a shard + + Shards end with `.shardN' where `N' is a natural number. + """ + if path[:-1].endswith('.shard'): + return True + else: + return False + + def housekeep(self): """Recursively traverses node directory, discovers changes and updates silo and combox directory. diff --git a/tests/events_test.py b/tests/events_test.py @@ -314,6 +314,16 @@ class TestEvents(object): observer.join() + def test_NDM_shardp(self): + """Testing shardp method in NodeDirMonitor class""" + shard = 'some.shard0' + not_shard = 'some.extension' + ndm = NodeDirMonitor(self.config) + + assert_equal(True, ndm.shardp(shard)) + assert_equal(False, ndm.shardp(not_shard)) + + def teardown(self): """Cleans up things after each test in this class""" purge_nodedirs(self.config)