From 6e0068bffd9a629e86ff28c462b272fd0b9b0ea3 Mon Sep 17 00:00:00 2001 From: David Stainton Date: Tue, 2 Jun 2015 12:32:26 -0700 Subject: [PATCH] Add private config magic_folder_parent_dircap - this commit also updates the tests --- src/allmydata/client.py | 8 +++++++- src/allmydata/test/test_client.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 6f6e7267..90f25eea 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -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() diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index 4ba40a78..e45fbb66 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -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], -- 2.45.2