mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
filetree: test NoSuchDirectoryError in vdrive.list()
This commit is contained in:
parent
7b8c524d7c
commit
9e7dbf20bc
@ -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):
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user