Fix tests which relied on the old behavior of tahoe cp -r

This commit is contained in:
Mark Berger 2013-08-05 11:53:44 -04:00 committed by Brian Warner
parent 1c96039270
commit 47c8616dd5
2 changed files with 18 additions and 18 deletions

View File

@ -2078,7 +2078,7 @@ class Cp(GridTestMixin, CLITestMixin, unittest.TestCase):
d = self.do_cli("create-alias", "tahoe")
d.addCallback(lambda res: self.do_cli("mkdir", "tahoe:test/" + artonwall_arg))
d.addCallback(lambda res: self.do_cli("cp", "-r", "tahoe:test", "tahoe:test2"))
d.addCallback(lambda res: self.do_cli("ls", "tahoe:test2"))
d.addCallback(lambda res: self.do_cli("ls", "tahoe:test2/test"))
def _check((rc, out, err)):
try:
unicode_to_output(u"\u00C4rtonwall")
@ -2242,20 +2242,20 @@ class Cp(GridTestMixin, CLITestMixin, unittest.TestCase):
self.childuris[k] = to_str(childdata[uri_key])
d.addCallback(_process_directory_json)
# Now build a local directory to copy into place, like the following:
# source1/
# source1/mutable1
# source1/mutable2
# source1/imm1
# source1/imm3
# test2/
# test2/mutable1
# test2/mutable2
# test2/imm1
# test2/imm3
def _build_local_directory(ignored):
source1_path = os.path.join(self.basedir, "source1")
fileutil.make_dirs(source1_path)
test2_path = os.path.join(self.basedir, "test2")
fileutil.make_dirs(test2_path)
for fn in ("mutable1", "mutable2", "imm1", "imm3"):
fileutil.write(os.path.join(source1_path, fn), fn * 1000)
self.source1_path = source1_path
fileutil.write(os.path.join(test2_path, fn), fn * 1000)
self.test2_path = test2_path
d.addCallback(_build_local_directory)
d.addCallback(lambda ignored:
self.do_cli("cp", "-r", self.source1_path, "tahoe:test2"))
self.do_cli("cp", "-r", self.test2_path, "tahoe:"))
# We expect that mutable1 and mutable2 are overwritten in-place,
# so they'll retain their URIs but have different content.
@ -2422,7 +2422,7 @@ class Cp(GridTestMixin, CLITestMixin, unittest.TestCase):
fileutil.write(os.path.join(test_dir_path, f), f * 10000)
d.addCallback(lambda ignored:
self.do_cli("cp", "-r", test_dir_path, "tahoe:test"))
self.do_cli("cp", "-r", test_dir_path, "tahoe:"))
d.addCallback(_check_error_message)
d.addCallback(lambda ignored:
self.do_cli("ls", "--json", "tahoe:test"))

View File

@ -1685,7 +1685,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
open(os.path.join(sdn2, "rfile5"), "wb").write("rfile5")
# from disk into tahoe
d.addCallback(run, "cp", "-r", dn, "tahoe:dir1")
d.addCallback(run, "cp", "-r", dn, "tahoe:")
d.addCallback(run, "ls")
d.addCallback(_check_ls, ["dir1"])
d.addCallback(run, "ls", "dir1")
@ -1703,7 +1703,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
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)
newfn = os.path.join(dn_copy, "dir1", name)
self.failUnless(os.path.exists(newfn))
new = open(newfn, "rb").read()
self.failUnlessEqual(old, new)
@ -1722,7 +1722,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
d.addCallback(run, "cp", "-r", "--caps-only", "tahoe:dir1", dn_copy2)
def _check_capsonly((out,err)):
# these should all be LITs
x = open(os.path.join(dn_copy2, "subdir2", "rfile4")).read()
x = open(os.path.join(dn_copy2, "dir1", "subdir2", "rfile4")).read()
y = uri.from_string_filenode(x)
self.failUnlessEqual(y.data, "rfile4")
d.addCallback(_check_capsonly)
@ -1731,13 +1731,13 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
d.addCallback(run, "cp", "-r", "tahoe:dir1", "tahoe:dir1-copy")
d.addCallback(run, "ls")
d.addCallback(_check_ls, ["dir1", "dir1-copy"])
d.addCallback(run, "ls", "dir1-copy")
d.addCallback(run, "ls", "dir1-copy/dir1")
d.addCallback(_check_ls, ["rfile1", "rfile2", "rfile3", "subdir2"],
["rfile4", "rfile5"])
d.addCallback(run, "ls", "tahoe:dir1-copy/subdir2")
d.addCallback(run, "ls", "tahoe:dir1-copy/dir1/subdir2")
d.addCallback(_check_ls, ["rfile4", "rfile5"],
["rfile1", "rfile2", "rfile3"])
d.addCallback(run, "get", "dir1-copy/subdir2/rfile4")
d.addCallback(run, "get", "dir1-copy/dir1/subdir2/rfile4")
d.addCallback(_check_stdout_against, data="rfile4")
# and copy it a second time, which ought to overwrite the same files