use std::path::PathBuf;
use org_gdocs::config::{Config, EnvInputs, Paths};
use org_gdocs::google::client::GoogleClient;
use org_gdocs::{auth, pull};
#[tokio::test]
#[ignore = "requires real Google OAuth credentials, network, and a commented doc; run manually"]
async fn live_pull_merges_ui_comments() {
#[allow(
clippy::disallowed_methods,
reason = "manual live-test fixture path, read once at the test edge (OVR-3)"
)]
let file = std::env::var_os("ORG_GDOCS_LIVE_FILE")
.map(PathBuf::from)
.expect("set ORG_GDOCS_LIVE_FILE to a pushed, commented org file");
let content = std::fs::read_to_string(&file).expect("read the live fixture file");
let paths = Paths::resolve(&EnvInputs::from_env()).expect("resolve paths");
let config = Config::load(&paths).expect("load config");
let authenticator = auth::authenticator(&config.credentials_path, &config.token_path)
.await
.expect("build authenticator (run `org-gdocs auth` first)");
let client = GoogleClient::new(authenticator).expect("build client");
let now = chrono::Utc::now().to_rfc3339();
let outcome = pull::pull(&client, &content, &now)
.await
.expect("live pull succeeds");
println!("document: {}", outcome.document_id);
println!("total comments: {}", outcome.total_comments);
println!("newly filed: {:?}", outcome.new_comment_ids);
println!("--- merged file ---\n{}", outcome.new_content);
assert!(outcome.new_content.contains("#+GDOC_LAST_PULL:"));
assert!(outcome.new_content.contains("** Active Comments"));
}