def test_redirect_prefix_encodes_newlines(): """Ensure raw newlines are url encoded in the generated redirect.""" request = Namespace(custom_fullpath='/\nSet-Cookie:malicious=1;') prefix = '\nSet-Cookie:malicious=1;' newpath = core.get_bad_url_redirect_path(request, prefix) assert '\n' not in newpath
def test_redirect_project_encodes_newlines(): """Ensure raw newlines are url encoded in the generated redirect.""" request = Namespace(custom_fullpath="/\nSet-Cookie:malicious=1;") project = "\nSet-Cookie:malicious=1;" newpath = core.get_bad_url_redirect_path(request, project) assert "\n" not in newpath