From: Daira Hopwood Date: Mon, 8 Jun 2015 23:02:09 +0000 (+0100) Subject: Add parent_dircap stub argument to DropUploader. refs ticket:2441 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/class-simplejson.JSONDecoder-index.html?a=commitdiff_plain;h=45becc117ddb96d5aa46b8b99ba54c8b3278661d;p=tahoe-lafs%2Ftahoe-lafs.git Add parent_dircap stub argument to DropUploader. refs ticket:2441 Author: David Stainton Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index b584bfab..6f6e7267 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -506,7 +506,7 @@ class Client(node.Node, pollmixin.PollMixin): from allmydata.frontends import drop_upload dbfile = os.path.join(self.basedir, "private", "magicfolderdb.sqlite") dbfile = abspath_expanduser_unicode(dbfile) - s = drop_upload.DropUploader(self, upload_dircap, local_dir, dbfile) + s = drop_upload.DropUploader(self, upload_dircap, '', local_dir, dbfile) s.setServiceParent(self) s.startService() diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py index 0375775f..d4504328 100644 --- a/src/allmydata/frontends/drop_upload.py +++ b/src/allmydata/frontends/drop_upload.py @@ -41,7 +41,7 @@ def get_inotify_module(): class DropUploader(service.MultiService): name = 'drop-upload' - def __init__(self, client, upload_dircap, local_dir, dbfile, inotify=None, + def __init__(self, client, upload_dircap, parent_dircap, local_dir, dbfile, inotify=None, pending_delay=1.0): precondition_abspath(local_dir) diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index 7483bebe..4ba40a78 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -306,7 +306,7 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test class MockDropUploader(service.MultiService): name = 'drop-upload' - def __init__(self, client, upload_dircap, local_dir, dbfile, inotify=None, + def __init__(self, client, upload_dircap, parent_dircap, local_dir, dbfile, inotify=None, pending_delay=1.0): service.MultiService.__init__(self) self.client = client diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py index 1d2e9b5b..999e0be5 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -50,10 +50,11 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, NonA self.failUnless(IDirectoryNode.providedBy(n)) self.upload_dirnode = n self.upload_dircap = n.get_uri() + self.parent_dircap = "abc123" def _create_uploader(self, ign): dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.basedir) - self.uploader = DropUploader(self.client, self.upload_dircap, self.local_dir, + self.uploader = DropUploader(self.client, self.upload_dircap, self.parent_dircap, self.local_dir, dbfile, inotify=self.inotify, pending_delay=0.2) self.uploader.setServiceParent(self.client) self.uploader.upload_ready() @@ -347,22 +348,22 @@ class MockTest(DropUploadTestMixin, unittest.TestCase): readonly_dircap = n.get_readonly_uri() self.shouldFail(AssertionError, 'nonexistent local.directory', 'there is no directory', - DropUploader, client, upload_dircap, doesnotexist, magicfolderdb, inotify=fake_inotify) + DropUploader, client, upload_dircap, '', doesnotexist, magicfolderdb, inotify=fake_inotify) self.shouldFail(AssertionError, 'non-directory local.directory', 'is not a directory', - DropUploader, client, upload_dircap, not_a_dir, magicfolderdb, inotify=fake_inotify) + DropUploader, client, upload_dircap, '', not_a_dir, magicfolderdb, inotify=fake_inotify) self.shouldFail(AssertionError, 'bad upload.dircap', 'does not refer to a directory', - DropUploader, client, 'bad', errors_dir, magicfolderdb, inotify=fake_inotify) + DropUploader, client, 'bad', '', errors_dir, magicfolderdb, inotify=fake_inotify) self.shouldFail(AssertionError, 'non-directory upload.dircap', 'does not refer to a directory', - DropUploader, client, 'URI:LIT:foo', errors_dir, magicfolderdb, inotify=fake_inotify) + DropUploader, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb, inotify=fake_inotify) self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory', - DropUploader, client, readonly_dircap, errors_dir, magicfolderdb, inotify=fake_inotify) + DropUploader, client, readonly_dircap, '', errors_dir, magicfolderdb, inotify=fake_inotify) def _not_implemented(): raise NotImplementedError("blah") self.patch(drop_upload, 'get_inotify_module', _not_implemented) self.shouldFail(NotImplementedError, 'unsupported', 'blah', DropUploader, client, upload_dircap, errors_dir, magicfolderdb) - d.addCallback(_check_errors) + d.addCallback(_check_errors) return d