mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-25 21:59:19 +00:00
Further expand existing test coverage by reducing fake quantities
Helper_fake_upload is replaced by more narrowly focused CHKUploadHelper_fake
This commit is contained in:
parent
4e46f9ae12
commit
555b751af0
@ -653,11 +653,15 @@ class Helper(Referenceable):
|
|||||||
si_s = si_b2a(storage_index)
|
si_s = si_b2a(storage_index)
|
||||||
incoming_file = os.path.join(self._chk_incoming, si_s)
|
incoming_file = os.path.join(self._chk_incoming, si_s)
|
||||||
encoding_file = os.path.join(self._chk_encoding, si_s)
|
encoding_file = os.path.join(self._chk_encoding, si_s)
|
||||||
uh = CHKUploadHelper(storage_index, self,
|
uh = self.chk_upload(
|
||||||
self._storage_broker,
|
storage_index,
|
||||||
self._secret_holder,
|
self,
|
||||||
incoming_file, encoding_file,
|
self._storage_broker,
|
||||||
lp)
|
self._secret_holder,
|
||||||
|
incoming_file,
|
||||||
|
encoding_file,
|
||||||
|
lp,
|
||||||
|
)
|
||||||
return uh
|
return uh
|
||||||
|
|
||||||
def _add_upload(self, uh):
|
def _add_upload(self, uh):
|
||||||
|
@ -72,18 +72,6 @@ class CHKUploadHelper_fake(offloaded.CHKUploadHelper):
|
|||||||
d.addCallback(_got_size)
|
d.addCallback(_got_size)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
class Helper_fake_upload(offloaded.Helper):
|
|
||||||
def _make_chk_upload_helper(self, storage_index, lp):
|
|
||||||
si_s = str(si_b2a(storage_index), "utf-8")
|
|
||||||
incoming_file = os.path.join(self._chk_incoming, si_s)
|
|
||||||
encoding_file = os.path.join(self._chk_encoding, si_s)
|
|
||||||
uh = CHKUploadHelper_fake(storage_index, self,
|
|
||||||
self._storage_broker,
|
|
||||||
self._secret_holder,
|
|
||||||
incoming_file, encoding_file,
|
|
||||||
lp)
|
|
||||||
return uh
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class FakeCHKCheckerAndUEBFetcher(object):
|
class FakeCHKCheckerAndUEBFetcher(object):
|
||||||
"""
|
"""
|
||||||
@ -183,12 +171,17 @@ class AssistedUpload(unittest.TestCase):
|
|||||||
# bogus host/port
|
# bogus host/port
|
||||||
t.setLocation(b"bogus:1234")
|
t.setLocation(b"bogus:1234")
|
||||||
|
|
||||||
def setUpHelper(self, basedir, helper_class=Helper_fake_upload, chk_checker=None):
|
def setUpHelper(self, basedir, chk_upload=CHKUploadHelper_fake, chk_checker=None):
|
||||||
fileutil.make_dirs(basedir)
|
fileutil.make_dirs(basedir)
|
||||||
self.helper = helper_class(basedir,
|
self.helper = offloaded.Helper(
|
||||||
self.s.storage_broker,
|
basedir,
|
||||||
self.s.secret_holder,
|
self.s.storage_broker,
|
||||||
None, None)
|
self.s.secret_holder,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if chk_upload is not None:
|
||||||
|
self.helper.chk_upload = chk_upload
|
||||||
if chk_checker is not None:
|
if chk_checker is not None:
|
||||||
self.helper.chk_checker = chk_checker
|
self.helper.chk_checker = chk_checker
|
||||||
self.helper_furl = self.tub.registerReference(self.helper)
|
self.helper_furl = self.tub.registerReference(self.helper)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user