Example #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)
Example #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)
Example #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)
Example #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)
Example #5
0
 def setUp(self):
     safe_remove(TESTFN)
Example #6
0
 def setUp(self):
     safe_remove(TESTFN)