From 4e1720ac15bc0579b9701231b2e4a3f196bc9b7b Mon Sep 17 00:00:00 2001 From: bescoto Date: Fri, 29 Aug 2003 18:04:06 +0000 Subject: Improved half-root test (added restore) git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@413 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/roottest.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/rdiff-backup/testing/roottest.py b/rdiff-backup/testing/roottest.py index 4c31a21..73fc4fd 100644 --- a/rdiff-backup/testing/roottest.py +++ b/rdiff-backup/testing/roottest.py @@ -48,7 +48,7 @@ class HalfRoot(unittest.TestCase): rp1_2.chmod(0) rp1_3 = rp1.append('unreadable_dir') rp1_3.mkdir() - rp1_3_1 = rp1_3.append('file inside') + rp1_3_1 = rp1_3.append('file_inside') rp1_3_1.write_string('blah') rp1_3.chmod(0) @@ -60,11 +60,13 @@ class HalfRoot(unittest.TestCase): rp2_1.chmod(0) rp2_3 = rp2.append('unreadable_dir') rp2_3.mkdir() + rp2_3_2 = rp2_3.append('file2') + rp2_3_2.touch() rp2_3.chmod(0) return rp1, rp2 def test_backup(self): - """Right now just test backing up""" + """Test back up, simple restores""" in_rp1, in_rp2 = self.make_dirs() outrp = rpath.RPath(Globals.local_connection, "testfiles/output") if outrp.lstat(): outrp.delete() @@ -86,6 +88,27 @@ class HalfRoot(unittest.TestCase): outrp.setdata() assert CompareRecursive(in_rp2, outrp) + rout_rp = rpath.RPath(Globals.local_connection, + "testfiles/restore_out") + Myrm(rout_rp.path) + cmd3 = cmd_schema % (10000, + "-r 10000 %s/unreadable_dir" % (outrp.path,), + remote_schema, rout_rp.path) + print "Executing restore: ", cmd3 + assert not os.system(cmd3) + rout_rp.setdata() + assert rout_rp.getperms() == 0, rout_rp.getperms() + + Myrm(rout_rp.path) + cmd4 = cmd_schema % (10000, + "-r now %s/unreadable_dir" % (outrp.path,), + remote_schema, rout_rp.path) + print "Executing restore: ", cmd4 + assert not os.system(cmd4) + rout_rp.setdata() + assert rout_rp.getperms() == 0, rout_rp.getperms() + + class NonRoot(unittest.TestCase): """Test backing up as non-root user -- cgit v1.2.1