Skip to main content

assert_redirects

Function assert_redirects 

Source
pub fn assert_redirects(res: &Response, target: &str)
Expand description

Assert the response is a 3xx redirect with Location exactly equal to target. Catches both the status check and the URL check in one assertion — Django’s assertRedirects shape.

assert_redirects(&res, "/login?next=%2Fprofile");

Does NOT follow the redirect or check what the target serves — pair with assert_redirect_chain for that.