]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add parent_dircap stub argument to DropUploader. refs ticket:2441
authorDaira Hopwood <daira@jacaranda.org>
Mon, 8 Jun 2015 23:02:09 +0000 (00:02 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 20 Jul 2015 23:20:55 +0000 (00:20 +0100)
Author: David Stainton <david@leastauthority.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/client.py
src/allmydata/frontends/drop_upload.py
src/allmydata/test/test_client.py
src/allmydata/test/test_drop_upload.py

index b584bfab562bb84a71afab0d198c06cc340122d3..6f6e72675e5271512b9c0bf210d8e7d9160ce80c 100644 (file)
@@ -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()
 
index 0375775f047f4c131e80f3cf25e98bbb5969fbd6..d450432852e4ff01ecae45582d1f953a46045070 100644 (file)
@@ -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)
 
index 7483bebe7a16f382a752cdb0167cd0ca4d5d3879..4ba40a78a9b77707e99266dc93c20f739adb3ff5 100644 (file)
@@ -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
index 1d2e9b5be33f353e71d65727a3a0246d51d8169d..999e0be56691a18f2b548dc11a8f4b9a14a73466 100644 (file)
@@ -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