diff options
Diffstat (limited to 'rdiff-backup/testing/robusttest.py')
-rw-r--r-- | rdiff-backup/testing/robusttest.py | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/rdiff-backup/testing/robusttest.py b/rdiff-backup/testing/robusttest.py index 199f317..8c6d51c 100644 --- a/rdiff-backup/testing/robusttest.py +++ b/rdiff-backup/testing/robusttest.py @@ -1,14 +1,13 @@ import os, unittest from commontest import * -from rdiff_backup.rpath import * -from rdiff_backup.robust import * +from rdiff_backup import rpath, robust, TempFile, Globals class TestRobustAction(unittest.TestCase): """Test some robust actions""" def testCopyWithAttribs(self): """Test copy with attribs action""" - rpin = RPath(Globals.local_connection, "./testfiles/robust/in") + rpin = rpath.RPath(Globals.local_connection, "./testfiles/robust/in") fp = open("./testfiles/robust/in", "wb") fp.write("hello there") fp.close() @@ -16,8 +15,8 @@ class TestRobustAction(unittest.TestCase): rpin.setdata() assert rpin.isreg() and rpin.getperms() % 01000 == 0604 - rpout = RPath(Globals.local_connection, "./testfiles/robust/out") - Robust.copy_with_attribs_action(rpin, rpout).execute() + rpout = rpath.RPath(Globals.local_connection, "./testfiles/robust/out") + robust.copy_with_attribs_action(rpin, rpout).execute() if not rpout == rpin: print rpout, rpin assert 0 @@ -28,17 +27,17 @@ class TestRobustAction(unittest.TestCase): class TempFileTest(unittest.TestCase): """Test creation and management of tempfiles""" - rp_base = RPath(Globals.local_connection, - "./testfiles/robust/testfile_base") + rp_base = rpath.RPath(Globals.local_connection, + "./testfiles/robust/testfile_base") def testBasic(self): """Make a temp file, write to it, and then delete it Also test tempfile accounting and file name prefixing. """ - assert not TempFileManager._tempfiles - tf = TempFileManager.new(self.rp_base) - assert TempFileManager._tempfiles == [tf] + assert not TempFile._tempfiles + tf = TempFile.new(self.rp_base) + assert TempFile._tempfiles == [tf] assert tf.dirsplit()[0] == "testfiles/robust", tf.dirsplit()[0] assert not tf.lstat() fp = tf.open("w") @@ -48,37 +47,37 @@ class TempFileTest(unittest.TestCase): assert fp.read() == "hello" assert not fp.close() tf.delete() - assert not TempFileManager._tempfiles + assert not TempFile._tempfiles def testRename(self): """Test renaming of tempfile""" - tf = TempFileManager.new(self.rp_base) - assert TempFileManager._tempfiles + tf = TempFile.new(self.rp_base) + assert TempFile._tempfiles tf.touch() - destination = RPath(Globals.local_connection, - "./testfiles/robust/testfile_dest") + destination = rpath.RPath(Globals.local_connection, + "./testfiles/robust/testfile_dest") tf.rename(destination) - assert not TempFileManager._tempfiles + assert not TempFile._tempfiles assert destination.lstat() destination.delete() class SaveStateTest(unittest.TestCase): """Test SaveState class""" - data_dir = RPath(Globals.local_connection, "testfiles/robust") + data_dir = rpath.RPath(Globals.local_connection, "testfiles/robust") def testSymlinking(self): """Test recording last file with symlink""" - last_rorp = RORPath(('usr', 'local', 'bin', 'ls')) + last_rorp = rpath.RORPath(('usr', 'local', 'bin', 'ls')) Globals.rbdir = self.data_dir Time.setcurtime() SetConnections.BackupInitConnections(Globals.local_connection, Globals.local_connection) - SaveState.init_filenames() - SaveState.record_last_file_action(last_rorp).execute() + robust.SaveState.init_filenames() + robust.SaveState.record_last_file_action(last_rorp).execute() - sym_rp = RPath(Globals.local_connection, - "testfiles/robust/last-file-incremented.%s.data" % - Time.curtimestr) + sym_rp = rpath.RPath(Globals.local_connection, + "testfiles/robust/last-file-incremented.%s.data" % + Time.curtimestr) assert sym_rp.issym() assert sym_rp.readlink() == "increments/usr/local/bin/ls" sym_rp.delete() |