From a50fdca6ab88e6b09f563559573b48248adf642d Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Sun, 27 Dec 2009 18:54:44 -0500
Subject: [PATCH] test_cli: verify fix for "tahoe get" not creating empty file
 on error (#121)

---
 src/allmydata/test/test_cli.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

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):
-- 
2.45.2