def testIsBackupNewer(self): """Test checking that the backup is newer""" fname = common.MakeTempFile("test2.txt") fobj = ebmlib.FileObjectImpl(fname) self.assertFalse(self.bkup.IsBackupNewer(fname)) time.sleep(1) # make sure modtime is different writer = self.bkup.GetBackupWriter(fobj) writer("TEST BACKUP") bname = self.bkup.GetBackupFilename(fname) self.assertTrue(self.bkup.IsBackupNewer(fname))
def setUp(self): self.path = common.GetDataFilePath(u'test_read_utf8.txt') self.file = ebmlib.FileObjectImpl(self.path) self.mtime = ebmlib.GetFileModTime(self.path)
def setUp(self): self.bkup = ebmlib.FileBackupMgr(None, u"%s~") self.path = common.MakeTempFile("test.txt") self.file = ebmlib.FileObjectImpl(self.path)
def testExists(self): """Test if the file exists""" self.assertTrue(self.file.Exists()) nfile = ebmlib.FileObjectImpl('some_fake_file') self.assertFalse(nfile.Exists())