Skip to content

Commit

Permalink
add missing assertions for simple options
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 10, 2022
1 parent 7ca4dec commit 9ff70e9
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion git-repository/tests/repository/config/transport_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,40 @@ mod http {
.transport_config("https://example.com/does/not/matter")
.expect("valid configuration")
.expect("configuration available for http");
let _options = http_config
let git_transport::client::http::Options {
extra_headers,
follow_redirects,
low_speed_limit_bytes_per_second,
low_speed_time_seconds,
proxy,
proxy_auth_method,
user_agent,
connect_timeout,
backend,
} = http_config
.downcast_ref::<git_transport::client::http::Options>()
.expect("http options have been created");
assert_eq!(extra_headers, &["ExtraHeader: value1", "ExtraHeader: value2"]);
assert_eq!(
*follow_redirects,
git_transport::client::http::options::FollowRedirects::Initial
);
assert_eq!(*low_speed_limit_bytes_per_second, 5000);
assert_eq!(*low_speed_time_seconds, 10);
assert_eq!(proxy.as_deref(), Some("localhost:9090"));
assert_eq!(
proxy_auth_method.as_ref(),
Some(&git_transport::client::http::options::ProxyAuthMethod::AnyAuth)
);
assert_eq!(user_agent.as_deref(), Some("agentJustForHttp"));
assert_eq!(
*connect_timeout,
std::time::Duration::from_secs(20),
"this is an arbitrary default, and it's her to allow adjustments of the default"
);
assert!(
backend.is_none(),
"backed is never set as it's backend specific, rather custom options typically"
)
}
}

0 comments on commit 9ff70e9

Please sign in to comment.