def test_organizeWithFiles(self): fields = DocumentFields() fields.setField("title", "document about internet") d = DocumentFolder() d.setDocFields(fields) bibfile = File("bibfile.bib") bibfile.createFile() pdffilename = "pdffile.pdf" pdffile = File(pdffilename) pdffile.createFile() fileList = [bibfile, pdffilename] d.create() d.organize(fileList) self.assertFalse(File("bibfile.bib").exists()) self.assertFalse(File("pdffile.pdf").exists()) folderPath = d.getDir().getPath().getAbsolutePath() newbibfile = File(folderPath + "/" + "bibfile.bib") newpdffile = File(folderPath + "/" + "pdffile.pdf") self.assertTrue(newbibfile.exists()) self.assertTrue(newpdffile.exists()) d.delete()
def test_move(self): f = File("hello") f.createFile() f.moveFile("newdest") self.assertTrue(f.exists()) self.assertEqual(f.getPath().path, "newdest") oldFile = File("hello") self.assertFalse(oldFile.exists()) f.removeFile() self.assertFalse(f.exists())
def test_remove(self): f = File("hello") f.removeFile() self.assertFalse(f.exists())
def test_create(self): f = File("hello") f.createFile() self.assertTrue(f.exists()) self.assertTrue(f.isRegularFile()) self.assertFalse(f.isDirectory())
def test_notExist(self): f = File("hello") self.assertFalse(f.exists())
def remove(self): f = File("hello") f.removeFile() assert(not f.exists())
def create(self): f = File("hello") f.createFile() assert(f.exists()) assert(f.isRegularFile()) assert(not f.isDirectory())
def notExist(self): f = File("hello") assert(not f.exists())