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()
예제 #2
0
    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())
예제 #3
0
 def test_remove(self):
     f = File("hello")
     f.removeFile()
     self.assertFalse(f.exists())
예제 #4
0
 def test_create(self):
     f = File("hello")
     f.createFile()
     self.assertTrue(f.exists())
     self.assertTrue(f.isRegularFile())
     self.assertFalse(f.isDirectory())
예제 #5
0
 def test_notExist(self):
     f = File("hello")
     self.assertFalse(f.exists())
예제 #6
0
 def remove(self): 
     f = File("hello")
     f.removeFile()
     assert(not f.exists())
예제 #7
0
 def create(self): 
     f = File("hello")
     f.createFile()
     assert(f.exists())
     assert(f.isRegularFile())
     assert(not f.isDirectory())
예제 #8
0
 def notExist(self): 
     f = File("hello")
     assert(not f.exists())