]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix magic-folder cli tests
authorDavid Stainton <dstainton415@gmail.com>
Mon, 29 Jun 2015 20:47:38 +0000 (13:47 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 20 Jul 2015 23:42:34 +0000 (00:42 +0100)
src/allmydata/test/test_cli_magic_folder.py

index a5815e66c275b2b106e2c1fd3de9a939ff619480..c623863a58137ea1f44938a1f888d263597aaa7e 100644 (file)
@@ -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