mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +00:00
mutable: oops, .download *is* in use, by the speedtest. Restore it and add a test.
This commit is contained in:
parent
4daa817502
commit
7d9bfbcabe
@ -1595,6 +1595,17 @@ class MutableFileNode:
|
||||
verifier = self.get_verifier()
|
||||
return self._client.getServiceNamed("checker").check(verifier)
|
||||
|
||||
def download(self, target):
|
||||
# fake it. TODO: make this cleaner.
|
||||
d = self.download_to_data()
|
||||
def _done(data):
|
||||
target.open(len(data))
|
||||
target.write(data)
|
||||
target.close()
|
||||
return target.finish()
|
||||
d.addCallback(_done)
|
||||
return d
|
||||
|
||||
def download_to_data(self):
|
||||
r = self.retrieve_class(self)
|
||||
self._client.notify_retrieve(r)
|
||||
|
@ -3,7 +3,7 @@ import itertools, struct
|
||||
from twisted.trial import unittest
|
||||
from twisted.internet import defer
|
||||
from twisted.python import failure, log
|
||||
from allmydata import mutable, uri, dirnode
|
||||
from allmydata import mutable, uri, dirnode, download
|
||||
from allmydata.util.hashutil import tagged_hash
|
||||
from allmydata.encode import NotEnoughPeersError
|
||||
from allmydata.interfaces import IURI, INewDirectoryURI, \
|
||||
@ -154,6 +154,8 @@ class Filenode(unittest.TestCase):
|
||||
d.addCallback(lambda res: n.replace("contents 2"))
|
||||
d.addCallback(lambda res: n.download_to_data())
|
||||
d.addCallback(lambda res: self.failUnlessEqual(res, "contents 2"))
|
||||
d.addCallback(lambda res: n.download(download.Data()))
|
||||
d.addCallback(lambda res: self.failUnlessEqual(res, "contents 2"))
|
||||
return d
|
||||
d.addCallback(_created)
|
||||
return d
|
||||
|
Loading…
Reference in New Issue
Block a user