#[cfg(unix)]
#[tokio::test]
async fn sign_in_browser_calls_the_external_opener_without_a_shell() {
let url = url::Url::parse("https://example.invalid/?a=1&b=two words").unwrap();
if let Some(record) = crate::platform::environment::var(crate::test_os::RECORD) {
crate::platform::program::open_desktop(std::ffi::OsStr::new(url.as_str()))
.await
.unwrap();
assert_eq!(
std::fs::read_to_string(record).unwrap(),
format!("1\n{}\n", url.as_str())
);
return;
}
let root = tempfile::tempdir().unwrap();
crate::test_os::recording_program(root.path(), crate::test_os::OPENER);
let output = crate::test_os::run_test(
"auth::codex::tests::sign_in_browser_calls_the_external_opener_without_a_shell",
&[
("PATH", crate::test_os::isolated_path(root.path())),
(
crate::test_os::RECORD,
root.path().join("record").into_os_string(),
),
],
);
assert!(
output.status.success(),
"{}{}",
crate::platform::output_text(&output.stdout),
crate::platform::output_text(&output.stderr)
);
}