summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-03-19 22:42:26 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-03-19 22:42:26 -0400
commit7dbd4907a7b351bcc022a55068449c987d1754df (patch)
tree9bfb278bc71628941df838f3b2f1e0b1d9b89f43 /tests
parent1f5e33f6607f44419935715fdd8b87cefede2950 (diff)
new function combox.file.node_paths: returns the abs. path of shards/directories in node directories.
modified: combox/file.py modified: tests/file_test.py
Diffstat (limited to 'tests')
-rw-r--r--tests/file_test.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/file_test.py b/tests/file_test.py
index 6517943..bd81fd7 100644
--- a/tests/file_test.py
+++ b/tests/file_test.py
@@ -157,6 +157,35 @@ class TestFile(object):
isfile=False)
+ def test_nodepaths(self):
+ """Tests the node_paths function."""
+ nodes = get_nodedirs(self.config)
+ node_iter = iter(nodes)
+
+ # test for file shards
+ foo = path.join(self.config['combox_dir'], 'foo.txt')
+ foo_rel_path = relative_path(foo, self.config)
+ foo_shards = node_paths(foo, self.config, True)
+
+ shard_no = 0
+ for foo_shard in foo_shards:
+ file_shard = '%s.shard%d' % (foo_rel_path, shard_no)
+ n_path = path.join(node_iter.next(), file_shard)
+ assert_equal(n_path, foo_shard)
+ shard_no += 1
+
+ # test for directory inside node_directories
+ bar = path.join(self.config['combox_dir'], 'bar')
+ bar_rel_path = relative_path(bar, self.config)
+ bar_n_paths = node_paths(bar, self.config, False)
+
+
+ node_iter = iter(nodes)
+ for bar_n_path in bar_n_paths:
+ b_n_path = path.join(node_iter.next(), bar_rel_path)
+ assert_equal(b_n_path, bar_n_path)
+
+
def test_rmpath(self):
"""Tests rm_path function"""
new_dir = path.join(self.config['combox_dir'], 'fooius')