From: Brian Warner Date: Thu, 22 May 2008 01:36:25 +0000 (-0700) Subject: test_system.py: improve 'cp -r' coverage: exercise copy from tahoe to local disk X-Git-Tag: allmydata-tahoe-1.1.0~82 X-Git-Url: https://git.rkrishnan.org/simplejson/%22news.html/install.html?a=commitdiff_plain;h=4824d058cc415fd10fed7d1f18416179c1292bcf;p=tahoe-lafs%2Ftahoe-lafs.git test_system.py: improve 'cp -r' coverage: exercise copy from tahoe to local disk --- diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index deb07c82..1b6dc495 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1812,6 +1812,23 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, testutil.StallMixin, d.addCallback(run, "get", "dir1/subdir2/rfile4") d.addCallback(_check_stdout_against, data="rfile4") + # and back out again + dn_copy = os.path.join(self.basedir, "dir1-copy") + d.addCallback(run, "cp", "--verbose", "-r", "tahoe:dir1", dn_copy) + def _check_cp_r_out((out,err)): + def _cmp(name): + old = open(os.path.join(dn, name), "rb").read() + newfn = os.path.join(dn_copy, name) + self.failUnless(os.path.exists(newfn)) + new = open(newfn, "rb").read() + self.failUnlessEqual(old, new) + _cmp("rfile1") + _cmp("rfile2") + _cmp("rfile3") + _cmp(os.path.join("subdir2", "rfile4")) + _cmp(os.path.join("subdir2", "rfile5")) + d.addCallback(_check_cp_r_out) + # tahoe_ls doesn't currently handle the error correctly: it tries to # JSON-parse a traceback. ## def _ls_missing(res):