From: Brian Warner Date: Sun, 27 Dec 2009 23:54:44 +0000 (-0500) Subject: test_cli: verify fix for "tahoe get" not creating empty file on error (#121) X-Git-Tag: trac-4200~57 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/css/somewhere?a=commitdiff_plain;h=a50fdca6ab88e6b09f563559573b48248adf642d;p=tahoe-lafs%2Ftahoe-lafs.git test_cli: verify fix for "tahoe get" not creating empty file on error (#121) --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index ee6770cf..34923d35 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -1602,8 +1602,8 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase): return d class Errors(GridTestMixin, CLITestMixin, unittest.TestCase): - def test_check(self): - self.basedir = "cli/Check/check" + def test_get(self): + self.basedir = "cli/Errors/get" self.set_up_grid() c0 = self.g.clients[0] self.fileurls = {} @@ -1622,6 +1622,16 @@ class Errors(GridTestMixin, CLITestMixin, unittest.TestCase): self.failUnlessIn("Failed to get enough shareholders: have 1, need 3", err) d.addCallback(_check1) + targetf = os.path.join(self.basedir, "output") + d.addCallback(lambda ign: self.do_cli("get", self.uri_1share, targetf)) + def _check2((rc, out, err)): + self.failIfEqual(rc, 0) + self.failUnless("410 Gone" in err, err) + self.failUnlessIn("NotEnoughSharesError: ", err) + self.failUnlessIn("Failed to get enough shareholders: have 1, need 3", err) + self.failIf(os.path.exists(targetf)) + d.addCallback(_check2) + return d class Stats(GridTestMixin, CLITestMixin, unittest.TestCase):