use org_gdocs::config::{Config, EnvInputs, Paths};
use org_gdocs::google::client::GoogleClient;
use org_gdocs::{auth, push};
const FULL_FEATURED: &str = include_str!("fixtures/full-featured.org");
#[tokio::test]
#[ignore = "requires real Google OAuth credentials and network; run manually"]
async fn live_push_full_featured_fixture() {
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 = push::push(&client, FULL_FEATURED, "Full Featured Fixture", &now)
.await
.expect("live push succeeds");
println!("pushed to: {}", outcome.document.url);
println!("created: {}", outcome.created);
println!("elements: {}", outcome.element_count);
println!("--- rewritten file ---\n{}", outcome.new_content);
assert!(!outcome.document.id.is_empty());
assert!(outcome.new_content.contains("#+GDOC_ID:"));
assert!(outcome.new_content.contains("* GDOC_METADATA :noexport:"));
assert!(outcome.new_content.contains("** Sync State"));
}