Extract and test resolve_redirect