コード例 #1
0
 def test_check_safe_path(self):
     if not tests_utils.coreutils_readlink_available():
         self.skipTest("coreutils readlink(1) unavailable")
     vfs = vfsimpl.VFSLocalFS("dummy.img")
     vfs.imgdir = "/foo"
     ret = vfs._canonical_path('etc/something.conf')
     self.assertEqual(ret, '/foo/etc/something.conf')
コード例 #2
0
ファイル: test_localfs.py プロジェクト: yatinkumbhare/nova
 def test_check_unsafe_path(self):
     if not tests_utils.coreutils_readlink_available():
         self.skipTest("coreutils readlink(1) unavailable")
     vfs = vfsimpl.VFSLocalFS("dummy.img")
     vfs.imgdir = "/foo"
     self.assertRaises(exception.Invalid, vfs._canonical_path,
                       'etc/../../../something.conf')
コード例 #3
0
 def test_check_unsafe_path(self):
     if not tests_utils.coreutils_readlink_available():
         self.skipTest("coreutils readlink(1) unavailable")
     vfs = vfsimpl.VFSLocalFS("dummy.img")
     vfs.imgdir = "/foo"
     self.assertRaises(exception.Invalid,
                       vfs._canonical_path,
                       'etc/../../../something.conf')