]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
filetree: test NoSuchDirectoryError in vdrive.list()
authorBrian Warner <warner@lothar.com>
Sun, 21 Jan 2007 11:50:37 +0000 (04:50 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 21 Jan 2007 11:50:37 +0000 (04:50 -0700)
src/allmydata/filetree/interfaces.py
src/allmydata/test/test_filetree_new.py

index 56079272a728a549f7b22516fbc2906f6a1bf2cf..665d1b63138c6ae912440f4f101fd5e1d5dd7936 100644 (file)
@@ -230,6 +230,9 @@ class IVirtualDrive(Interface):
         Interfaces: either IDirectoryNode if path+[childname] can be used in
         a 'list' method, or IFileNode if path+[childname] can be used in a
         'download' method.
+
+        The Deferred will errback (with NoSuchDirectoryError) if the path
+        does not point to an actual directory.
         """
 
     def download(path, target):
index 8cc3d2bbb603853e01349ddbf2036f24e5ea02ee..2f1eccb3bde3023cea04b0fd25936ed20d801f03 100644 (file)
@@ -313,8 +313,10 @@ class Redirect(unittest.TestCase):
 """
 
 import os.path
+from twisted.python.failure import Failure
 from allmydata.filetree import directory, redirect, vdrive
-from allmydata.filetree.interfaces import (ISubTree, INode, IDirectoryNode, IFileNode)
+from allmydata.filetree.interfaces import (ISubTree, INode, IDirectoryNode,
+                                           IFileNode, NoSuchDirectoryError)
 from allmydata.filetree.file import CHKFileNode
 from allmydata.util import bencode
 
@@ -467,5 +469,16 @@ class Stuff(unittest.TestCase):
                                             {"c": child2, "d": child3})
         d.addCallback(_listed4)
 
+        #d.addCallback(lambda res: v._get_file_uri(["b","c"]))
+        #d.addCallback(self.failUnlessEqual, "uri2")
+
+        d.addCallback(lambda res: v.list(["bogus"]))
+        def _listed_bogus(res):
+            if isinstance(res, Failure):
+                res.trap(NoSuchDirectoryError)
+            else:
+                self.fail("list(bogus) was supposed to fail")
+        d.addBoth(_listed_bogus)
+
         return d