From 49be394fe727dc56287eeb7f9a6ef5d24514899b Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 9 Jun 2015 00:02:09 +0100 Subject: [PATCH] Add parent_dircap stub argument to DropUploader. refs ticket:2441 Author: David Stainton Signed-off-by: Daira Hopwood --- src/allmydata/client.py | 2 +- src/allmydata/frontends/drop_upload.py | 2 +- src/allmydata/test/test_client.py | 2 +- src/allmydata/test/test_drop_upload.py | 15 ++++++++------- 4 files changed, 11 insertions(+), 10 deletions(-) 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 -- 2.45.2