assert_eq!(response.status(), status);
assert_regex_match!(response.text().unwrap(), regex.as_ref());
}
fn assert_response_csp(
&self,
path: impl AsRef<str>,
status: StatusCode,
content_security_policy: &str,
regex: impl AsRef<str>,
) {
let response = self.get(path);
assert_eq!(response.status(), status);
assert_eq!(
response
.headers()
.get(header::CONTENT_SECURITY_POLICY,)
.unwrap(),
content_security_policy
);
assert_regex_match!(response.text().unwrap(), regex.as_ref());
}
fn assert_redirect(&self, path: &str, location: &str) {
let response = reqwest::blocking::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.build()
.unwrap()
.get(self.join_url(path))
.send()
.unwrap();
assert_eq!(response.status(), StatusCode::SEE_OTHER);
assert_eq!(response.headers().get(header::LOCATION).unwrap(), location);