def assert_no_path_traversal(dest_dir_path, target_path): # type: (str, str) -> None if not is_within_directory(dest_dir_path, target_path): message = ("The wheel {!r} has a file {!r} trying to install" " outside the target directory {!r}") raise InstallationError( message.format(wheel_path, target_path, dest_dir_path))
def test_is_within_directory(args: Tuple[str, str], expected: bool) -> None: result = is_within_directory(*args) assert result == expected
def test_is_within_directory(args, expected): result = is_within_directory(*args) assert result == expected