From: Daira Hopwood <daira@jacaranda.org>
Date: Sat, 11 Oct 2014 22:43:23 +0000 (+0100)
Subject: Adds test_ticket_2027 to test_cli.Cp. refs #2027
X-Git-Tag: allmydata-tahoe-1.10.1a1~77^2~5
X-Git-Url: https://git.rkrishnan.org/pf/vdrive/index.html?a=commitdiff_plain;h=b6a645aeb3c296e6f09c1dc6753cdc9832ebfad6;p=tahoe-lafs%2Ftahoe-lafs.git

Adds test_ticket_2027 to test_cli.Cp. refs #2027

Author: Mark Berger <mark.berger.j@gmail.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py
index f672ea12..b39cafc4 100644
--- a/src/allmydata/test/test_cli.py
+++ b/src/allmydata/test/test_cli.py
@@ -2509,6 +2509,28 @@ starting copy, 2 files, 1 directories
         d.addCallback(_check_local_fs)
         return d
 
+    def test_ticket_2027(self):
+        # This test ensures that tahoe will copy a file from the grid to
+        # a local directory without a specified file name.
+        # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2027
+        self.basedir = "cli/Cp/cp_verbose"
+        self.set_up_grid()
+
+        # Write a test file, which we'll copy to the grid.
+        test1_path = os.path.join(self.basedir, "test1")
+        fileutil.write(test1_path, "test1")
+
+        d = self.do_cli("create-alias", "tahoe")
+        d.addCallback(lambda ign:
+            self.do_cli("cp", test1_path, "tahoe:"))
+        d.addCallback(lambda ign:
+            self.do_cli("cp", "tahoe:test1", self.basedir))
+        def _check(res):
+            (rc, out, err) = res
+            self.failUnlessIn("Success: file copied", out, str(res))
+        return d
+
+
 class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
 
     def writeto(self, path, data):