aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/util/stream_context_factory_test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/tests/util/stream_context_factory_test.rs')
-rw-r--r--crates/shirabe/tests/util/stream_context_factory_test.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/shirabe/tests/util/stream_context_factory_test.rs b/crates/shirabe/tests/util/stream_context_factory_test.rs
index 6f484fa..f75c78d 100644
--- a/crates/shirabe/tests/util/stream_context_factory_test.rs
+++ b/crates/shirabe/tests/util/stream_context_factory_test.rs
@@ -3,11 +3,44 @@
// These build a stream context and assert proxy/option handling driven by HTTP(S)_PROXY /
// no_proxy environment variables; the env-dependent setup (without its setUp/tearDown
// isolation) is not ported.
+use shirabe::util::http::proxy_manager::ProxyManager;
+use shirabe::util::platform::Platform;
+
+fn set_up() {
+ Platform::clear_env("HTTP_PROXY");
+ Platform::clear_env("http_proxy");
+ Platform::clear_env("HTTPS_PROXY");
+ Platform::clear_env("https_proxy");
+ Platform::clear_env("NO_PROXY");
+ Platform::clear_env("no_proxy");
+ ProxyManager::reset();
+}
+
+fn tear_down() {
+ Platform::clear_env("HTTP_PROXY");
+ Platform::clear_env("http_proxy");
+ Platform::clear_env("HTTPS_PROXY");
+ Platform::clear_env("https_proxy");
+ Platform::clear_env("NO_PROXY");
+ Platform::clear_env("no_proxy");
+ ProxyManager::reset();
+}
+
+struct TearDown;
+
+impl Drop for TearDown {
+ fn drop(&mut self) {
+ tear_down();
+ }
+}
+
macro_rules! stub {
($name:ident) => {
#[test]
#[ignore = "not yet ported (StreamContextFactory proxy/option building is driven by proxy env vars)"]
fn $name() {
+ let _tear_down = TearDown;
+ set_up();
todo!()
}
};