Exemplo n.º 1
0
 def test_chmod(self):
     try:
         fo = FileObject("test", temporary=True)
         fo.chmod(0o644)
         if oct(os.stat(fo.path).st_mode & 0o777) != oct(0o644):
             raise Exception("Wrong mode of file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
Exemplo n.º 2
0
 def test_remove(self):
     try:
         fo = FileObject("test", temporary=True)
         fo.remove()
         if os.path.exists(fo.path):
             raise Exception("File has not been removed")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
Exemplo n.º 3
0
 def test_move(self):
     try:
         fo = FileObject("test", temporary=True)
         fo.move("test_move")
         if not os.path.exists("test_move"):
             raise Exception("Failed to move")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
 def test_index_file(self):
     try:
         fo = FileObject("test_file", temporary=True)
         do = DirectoryObject("test_dir", temporary=True)
         fo.parent = do
         if do.index(fo) is None:
             raise Exception("Parent hasn't been set")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
Exemplo n.º 5
0
 def test_copy(self):
     try:
         fo = FileObject("test", temporary=True)
         fo_copy = fo.copy("test_copy")
         if not isinstance(fo_copy, FileObject):
             raise Exception("FileObject hasn't been returned as copy")
         if not os.path.exists("test_copy"):
             raise Exception("Failed to copy")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)