From d70afc167fb9d5d0acedb5bf0b8aad560c565f3d 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 48e87e67..6af25c52 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -331,6 +331,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"), @@ -361,6 +362,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 mock_log_msg.call_args_list if "Boom" in repr(arg)], -- 2.45.2