use super::*;
#[test]
fn nested_invalid_data_is_a_tls_failure() {
use std::io::{Error, ErrorKind};
let handshake = Error::other(Error::new(ErrorKind::InvalidData, "bad certificate"));
assert!(tls(&handshake));
assert!(!tls(&Error::from(ErrorKind::ConnectionRefused)));
}
#[test]
fn urls_need_https_except_on_loopback() {
for url in [
"https://reviews.example",
"https://reviews.example/team/",
"http://127.0.0.1:8417",
"http://[::1]:8417/",
"http://localhost:8417/",
] {
assert!(parse_url(url).unwrap().path().ends_with('/'), "{url}");
}
for url in [
"http://reviews.example/",
"http://10.0.0.1/",
"https://user:secret@reviews.example/",
"https://reviews.example/?token=x",
"ftp://reviews.example/",
"reviews.example",
] {
assert!(parse_url(url).is_err(), "{url}");
}
}