From: David Stainton Date: Mon, 29 Jun 2015 20:47:38 +0000 (-0700) Subject: Fix magic-folder cli tests X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=8c957a4e823b27b3aa82821d7a116cdddd8842c1;p=tahoe-lafs%2Ftahoe-lafs.git Fix magic-folder cli tests --- diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index a5815e66..c623863a 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -37,8 +37,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): d.addCallback(_done) return d - def join(self, client_num, local_dir, invite_result): - invite_code = result[1].strip() + def join(self, client_num, local_dir, invite_code): magic_readonly_cap, dmd_write_cap = invite_code.split(magic_folder_cli.INVITE_SEPERATOR) d = self.do_cli_n(client_num, "magic-folder", "join", invite_code, local_dir) def _done((rc,stdout,stderr)): @@ -95,9 +94,11 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): self.failUnless(rc == 0) return (rc,stdout,stderr) d.addCallback(_done) - d.addCallback(self.get_caps_from_files) - d.addCallback(self.check_joined_config) - d.addCallback(self.check_config) + def get_alice_caps(x): + alice_collective_dircap, alice_upload_dircap = self.get_caps_from_files(0) + d.addCallback(get_alice_caps) + d.addCallback(lambda x: self.check_joined_config(0, alice_upload_dircap)) + d.addCallback(lambda x: self.check_config(1, alice_magic_dir)) return d def cleanup(self, res): @@ -152,13 +153,17 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase): self.basedir = "cli/MagicFolder/create-and-then-invite-join" self.set_up_grid() self.local_dir = os.path.join(self.basedir, "magic") - d = self.create_magic_folder(0) - d.addCallback(self._invite) - d.addCallback(self._join) - d.addCallback(self.get_caps_from_files) - d.addCallback(self.check_joined_config) - d.addCallback(self.check_config) + d.addCallback(lambda x: self.invite(0, u"Alice")) + def get_invite((rc,stdout,stderr)): + self.invite_code = stdout.strip() + d.addCallback(get_invite) + d.addCallback(lambda x: self.join(0, self.local_dir, self.invite_code)) + def get_caps(x): + self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0) + d.addCallback(get_caps) + d.addCallback(lambda x: self.check_joined_config(0, self.upload_dircap)) + d.addCallback(lambda x: self.check_config(0, self.local_dir)) return d def test_create_invite_join(self): @@ -170,8 +175,10 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase): self.failUnless(rc == 0) return (rc,stdout,stderr) d.addCallback(_done) - d.addCallback(self.get_caps_from_files) - d.addCallback(self.check_joined_config) - d.addCallback(self.check_config) + def get_caps(x): + self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0) + d.addCallback(get_caps) + d.addCallback(lambda x: self.check_joined_config(0, self.upload_dircap)) + d.addCallback(lambda x: self.check_config(0, self.local_dir)) return d