Tests for BasicFileStorage.delete_file()
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 16 Apr 2011 16:03:32 +0000 (11:03 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 16 Apr 2011 16:03:32 +0000 (11:03 -0500)
mediagoblin/tests/test_storage.py

index 38c820bfca51efea9219fb63b7c9fb32784ac45d..6a73cd82e470da79f6e721ffe7c3a74ab97a2106 100644 (file)
@@ -140,7 +140,22 @@ def test_basic_storage_get_file():
 
 
 def test_basic_storage_delete_file():
-    pass
+    tmpdir, this_storage = get_tmp_filestorage()
+
+    assert not os.path.exists(
+        os.path.join(tmpdir, 'dir1/dir2/ourfile.txt'))
+
+    filepath = ['dir1', 'dir2', 'ourfile.txt']
+    with this_storage.get_file(filepath, 'w') as our_file:
+        our_file.write('Testing this file')
+
+    assert os.path.exists(
+        os.path.join(tmpdir, 'dir1/dir2/ourfile.txt'))
+
+    this_storage.delete_file(filepath)
+    
+    assert not os.path.exists(
+        os.path.join(tmpdir, 'dir1/dir2/ourfile.txt'))
 
 
 def test_basic_storage_url_for_file():