diff options
author | Siddharth Ravikumar <sravik@bgsu.edu> | 2015-02-25 22:36:05 -0500 |
---|---|---|
committer | Siddharth Ravikumar <sravik@bgsu.edu> | 2015-02-25 22:36:05 -0500 |
commit | 5a9f2b72399d406e86dadb9cb15ae948e08293cc (patch) | |
tree | 6fb521fb53f8fdcabd26c2eee8f4b250eec78ebc /tests/file_test.py | |
parent | a74c583656f3d9fadf50cf070e58235db1b2de90 (diff) |
new function combox.file.node_path.
This function takes the path to the file in the combox and returns the
path of its first shard in the node directory. If the the given
argument is a directory (inside the combox directory), the function
returns the corresponding path of the directory under the first node
directory.
Test for the function was also written.
modified: combox/file.py
modified: tests/file_test.py
Diffstat (limited to 'tests/file_test.py')
-rw-r--r-- | tests/file_test.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/file_test.py b/tests/file_test.py index 3e14343..0ee75d4 100644 --- a/tests/file_test.py +++ b/tests/file_test.py @@ -129,6 +129,25 @@ class TestFile(object): 'foo') assert foo_dir == cb_path(foo_nodedir, self.config) + + def test_nodepath(self): + """Tests the node_path function""" + split_and_encrypt(self.TEST_FILE, self.config) + test_file_shard_0 = '%s.shard0' % path.basename(self.TEST_FILE) + test_file_shard_0_abspath = path.join(get_nodedirs(self.config)[0], + test_file_shard_0) + + assert test_file_shard_0_abspath == node_path(self.TEST_FILE, + self.config) + + + foo_dir = path.join(self.config['combox_dir'], 'foo') + foo_nodedir = path.join(get_nodedirs(self.config)[0], + 'foo') + + assert foo_nodedir == node_path(foo_dir, self.config) + + @classmethod def teardown_class(self): """Purge the mess created by this test.""" |