def testBackupCustomDirectory(self): """"Test doing a backup to a custom directory""" bkup = ebmlib.FileBackupMgr() bkup.SetBackupDirectory(common.GetTempDir()) self.assertTrue(bkup.MakeBackupCopy(__file__)) path = bkup.GetBackupFilename(__file__) self.assertTrue(os.path.exists(path), "Path Fail: %s" % path)
def testBackupWithHeader(self): """Tests using the backup file header identifier option""" bkup = ebmlib.FileBackupMgr("SuperHeader", u"%s~") path = common.MakeTempFile("test_header.txt") self.assertTrue(bkup.MakeBackupCopy(path)) bkupf = bkup.GetBackupFilename(path) self.assertTrue(os.path.exists(bkupf), "Invalid path: %s" % bkupf) txt = common.GetFileContents(bkupf) self.assertTrue(txt.startswith("SuperHeader"))
def setUp(self): self.bkup = ebmlib.FileBackupMgr(None, u"%s~") self.path = common.MakeTempFile("test.txt") self.file = ebmlib.FileObjectImpl(self.path)