]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_cli: verify fix for "tahoe get" not creating empty file on error (#121)
authorBrian Warner <warner@lothar.com>
Sun, 27 Dec 2009 23:54:44 +0000 (18:54 -0500)
committerBrian Warner <warner@lothar.com>
Sun, 27 Dec 2009 23:54:44 +0000 (18:54 -0500)
src/allmydata/test/test_cli.py

index ee6770cfaa4895c93129a0dc85e550c9170aafc7..34923d35e20e7c1241a68496a3048347a2f07dd9 100644 (file)
@@ -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):