diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-11 12:04:30 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-11 12:04:30 -0500 |
commit | 6a07362dd0145643edf4b61b0ae402e3093793c2 (patch) | |
tree | 85a656ef269cebfb8e55959783be4ccfc9edd258 /mediagoblin/tests | |
parent | 3a89c23e7fd330ea662dd57ff74a9d424d476b84 (diff) | |
download | mediagoblin-6a07362dd0145643edf4b61b0ae402e3093793c2.tar.lz mediagoblin-6a07362dd0145643edf4b61b0ae402e3093793c2.tar.xz mediagoblin-6a07362dd0145643edf4b61b0ae402e3093793c2.zip |
Adding a copy_locally() method to the StorageInterface and giving it a test.
Diffstat (limited to 'mediagoblin/tests')
-rw-r--r-- | mediagoblin/tests/test_storage.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_storage.py b/mediagoblin/tests/test_storage.py index 5efed405..83f893f1 100644 --- a/mediagoblin/tests/test_storage.py +++ b/mediagoblin/tests/test_storage.py @@ -231,3 +231,19 @@ def test_basic_storage_get_local_path(): def test_basic_storage_is_local(): tmpdir, this_storage = get_tmp_filestorage() assert this_storage.local_storage is True + + +def test_basic_storage_copy_locally(): + tmpdir, this_storage = get_tmp_filestorage() + + dest_tmpdir = tempfile.mkdtemp() + + filepath = ['dir1', 'dir2', 'ourfile.txt'] + with this_storage.get_file(filepath, 'w') as our_file: + our_file.write('Testing this file') + + new_file_dest = os.path.join(dest_tmpdir, 'file2.txt') + + this_storage.copy_locally(filepath, new_file_dest) + + assert file(new_file_dest).read() == 'Testing this file' |