def test_check_unsafe_path(self): if tests_utils.is_osx(): self.skipTest("Unable to test on OSX") vfs = vfsimpl.VFSLocalFS("dummy.img") vfs.imgdir = "/foo" self.assertRaises(exception.Invalid, vfs._canonical_path, 'etc/../../../something.conf')
def test_check_safe_path(self): if tests_utils.is_osx(): self.skipTest("Unable to test on OSX") vfs = vfsimpl.VFSLocalFS("dummy.img") vfs.imgdir = "/foo" ret = vfs._canonical_path('etc/something.conf') self.assertEquals(ret, '/foo/etc/something.conf')