From 5b3c89a56527fb5af1b63f9e960ebbec4e1f78e4 Mon Sep 17 00:00:00 2001 From: David Stainton Date: Thu, 3 Dec 2015 04:44:54 +0200 Subject: [PATCH] Add unit test for join twice failure --- src/allmydata/test/test_cli_magic_folder.py | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index c69ee1e0..5ea214cb 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -243,3 +243,30 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase): self.failUnlessIn("cannot start with '-'", str(e)) else: self.fail("expected UsageError") + + def test_join_twice_failure(self): + self.basedir = "cli/MagicFolder/create-join-twice-failure" + os.makedirs(self.basedir) + self.set_up_grid() + local_dir = os.path.join(self.basedir, "magic") + abs_local_dir_u = abspath_expanduser_unicode(unicode(local_dir), long_path=False) + + d = self.do_create_magic_folder(0) + d.addCallback(lambda ign: self.do_invite(0, u"Alice")) + def get_invite_code_and_join((rc, stdout, stderr)): + self.invite_code = stdout.strip() + return self.do_join(0, unicode(local_dir), self.invite_code) + d.addCallback(get_invite_code_and_join) + def get_caps(ign): + self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0) + d.addCallback(get_caps) + d.addCallback(lambda ign: self.check_joined_config(0, self.upload_dircap)) + d.addCallback(lambda ign: self.check_config(0, abs_local_dir_u)) + def join_again(ignore): + return self.do_cli("magic-folder", "join", self.invite_code, local_dir, client_num=0) + d.addCallback(join_again) + def get_results(result): + code = result[0] + self.failIfEqual(code, 0) + d.addCallback(get_results) + return d -- 2.45.2