Add private config magic_folder_parent_dircap
authorDavid Stainton <dstainton415@gmail.com>
Tue, 2 Jun 2015 19:32:26 +0000 (12:32 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Thu, 1 Oct 2015 00:19:43 +0000 (01:19 +0100)
- this commit also updates the tests

src/allmydata/client.py
src/allmydata/test/test_client.py

index 6f6e72675e5271512b9c0bf210d8e7d9160ce80c..90f25eeac82887848e3f9ba5cee459d3eee43187 100644 (file)
@@ -506,7 +506,13 @@ 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)
+
+                magic_folder_parent_dircap = os.path.join(self.basedir, "private", "magic_folder_parent_dircap")
+                magic_folder_parent_dircap = abspath_expanduser_unicode(magic_folder_parent_dircap)
+                fh = open(magic_folder_parent_dircap, "r")
+                parent_dircap = fh.read().strip()
+
+                s = drop_upload.DropUploader(self, upload_dircap, parent_dircap, local_dir, dbfile)
                 s.setServiceParent(self)
                 s.startService()
 
index 4ba40a78a9b77707e99266dc93c20f739adb3ff5..e45fbb6623f0c2963092acea1bc410ca6e14ba1e 100644 (file)
@@ -334,6 +334,7 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
 
         fileutil.write(os.path.join(basedir1, "tahoe.cfg"), config)
         fileutil.write(os.path.join(basedir1, "private", "drop_upload_dircap"), "URI:DIR2:blah")
+        fileutil.write(os.path.join(basedir1, "private", "magic_folder_parent_dircap"), "URI:DIR2:meow")
         self.failUnlessRaises(MissingConfigEntry, client.Client, basedir1)
 
         fileutil.write(os.path.join(basedir1, "tahoe.cfg"),
@@ -371,6 +372,7 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
                        "enabled = true\n" +
                        "local.directory = " + local_dir_utf8 + "\n")
         fileutil.write(os.path.join(basedir2, "private", "drop_upload_dircap"), "URI:DIR2:blah")
+        fileutil.write(os.path.join(basedir2, "private", "magic_folder_parent_dircap"), "URI:DIR2:meow")
         c2 = client.Client(basedir2)
         self.failUnlessRaises(KeyError, c2.getServiceNamed, 'drop-upload')
         self.failUnless([True for arg in logged_messages if "Boom" in arg],