From: Brian Warner Date: Sat, 7 Mar 2009 12:08:15 +0000 (-0700) Subject: test_cli.py: assert that 'ls' on an unrecoverable file now gives a better error message X-Git-Tag: allmydata-tahoe-1.4.0~81 X-Git-Url: https://git.rkrishnan.org/pb.xhtml?a=commitdiff_plain;h=2c2c3c2295ccfe87403abe516ccccddcf064e37d;p=tahoe-lafs%2Ftahoe-lafs.git test_cli.py: assert that 'ls' on an unrecoverable file now gives a better error message --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 7f92b0f9..dcab060f 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -739,6 +739,52 @@ class Put(GridTestMixin, CLITestMixin, unittest.TestCase): d.addCallback(lambda (rc,out,err): self.failUnlessEqual(out, DATA2)) return d +class List(GridTestMixin, CLITestMixin, unittest.TestCase): + def test_list(self): + self.basedir = "cli/List/list" + self.set_up_grid() + c0 = self.g.clients[0] + d = c0.create_empty_dirnode() + def _stash_root_and_create_file(n): + self.rootnode = n + self.rooturi = n.get_uri() + return n.add_file(u"good", upload.Data("small", convergence="")) + d.addCallback(_stash_root_and_create_file) + d.addCallback(lambda ign: + self.rootnode.create_empty_directory(u"1share")) + d.addCallback(lambda n: + self.delete_shares_numbered(n.get_uri(), range(1,10))) + d.addCallback(lambda ign: + self.rootnode.create_empty_directory(u"0share")) + d.addCallback(lambda n: + self.delete_shares_numbered(n.get_uri(), range(0,10))) + d.addCallback(lambda ign: + self.do_cli("add-alias", "tahoe", self.rooturi)) + d.addCallback(lambda ign: self.do_cli("ls")) + def _check1((rc,out,err)): + self.failUnlessEqual(err, "") + self.failUnlessEqual(rc, 0) + self.failUnlessEqual(out.splitlines(), ["0share", "1share", "good"]) + d.addCallback(_check1) + d.addCallback(lambda ign: self.do_cli("ls", "missing")) + def _check2((rc,out,err)): + self.failIfEqual(rc, 0) + self.failUnlessEqual(err.strip(), "No such file or directory") + self.failUnlessEqual(out, "") + d.addCallback(_check2) + d.addCallback(lambda ign: self.do_cli("ls", "1share")) + def _check3((rc,out,err)): + self.failIfEqual(rc, 0) + self.failUnlessIn("Error during GET: 410 Gone ", err) + self.failUnlessIn("UnrecoverableFileError:", err) + self.failUnlessIn("could not be retrieved, because there were " + "insufficient good shares.", err) + self.failUnlessEqual(out, "") + d.addCallback(_check3) + d.addCallback(lambda ign: self.do_cli("ls", "0share")) + d.addCallback(_check3) + return d + class Cp(GridTestMixin, CLITestMixin, unittest.TestCase): def test_not_enough_args(self):