Пример #1
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     TESTFN2 = TESTFN + '1'
     try:
         touch(TESTFN)
         os.symlink(TESTFN, TESTFN2)
         self.assertTrue(fs.validpath(u(TESTFN)))
     finally:
         safe_remove(TESTFN, TESTFN2)
Пример #2
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     TESTFN2 = TESTFN + '1'
     try:
         touch(TESTFN)
         os.symlink(TESTFN, TESTFN2)
         self.assertTrue(fs.validpath(u(TESTFN)))
     finally:
         safe_remove(TESTFN, TESTFN2)
Пример #3
0
 def test_validpath_external_symlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # outside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     # tempfile should create our file in /tmp directory
     # which should be outside the user root.  If it is
     # not we just skip the test.
     with tempfile.NamedTemporaryFile() as file:
         try:
             if HOME == os.path.dirname(file.name):
                 return
             os.symlink(file.name, TESTFN)
             self.assertFalse(fs.validpath(u(TESTFN)))
         finally:
             safe_remove(TESTFN)
Пример #4
0
 def test_validpath_external_symlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # outside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     # tempfile should create our file in /tmp directory
     # which should be outside the user root.  If it is
     # not we just skip the test.
     with tempfile.NamedTemporaryFile() as file:
         try:
             if HOME == os.path.dirname(file.name):
                 return
             os.symlink(file.name, TESTFN)
             self.assertFalse(fs.validpath(u(TESTFN)))
         finally:
             safe_remove(TESTFN)
Пример #5
0
 def setUp(self):
     safe_remove(TESTFN)
Пример #6
0
 def setUp(self):
     safe_remove(TESTFN)