summaryrefslogtreecommitdiffstats
path: root/tests/file_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/file_test.py')
-rw-r--r--tests/file_test.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/file_test.py b/tests/file_test.py
index d8a77ca..f3a153d 100644
--- a/tests/file_test.py
+++ b/tests/file_test.py
@@ -222,6 +222,36 @@ class TestFile(object):
self.purge_list.append(new_dir)
+ def test_noofshards(self):
+ """Tests the node_paths function."""
+ nodes = get_nodedirs(self.config)
+ node_iter = iter(nodes)
+ lorem = path.join(self.config['combox_dir'], 'lorem.txt')
+
+ # get the shards on the node directories
+ split_and_encrypt(lorem, self.config)
+
+ # no. of shards must be equal to no. of node directories.
+ assert_equal(no_of_shards(lorem, self.config),
+ len(nodes))
+
+ n_paths = node_paths(lorem, self.config, isfile=True)
+
+ # now remove first shard
+ rm_path(n_paths[0])
+ # no. of shards must be equal to one less than the no. of node
+ # directories.
+ assert_equal(no_of_shards(lorem, self.config),
+ len(nodes) - 1)
+
+ # now remove second shard
+ rm_path(n_paths[1])
+ # no. of shards must be equal to two less than the no. of node
+ # directories.
+ assert_equal(no_of_shards(lorem, self.config),
+ len(nodes) - 2)
+
+
def teardown(self):
"""Cleans up things after each test in this class."""
purge(self.purge_list)