tftio-org-gdocs 0.1.3

Sync org-mode documents to Google Docs and pull reviewer comments back into org-mode
Documentation
//! Live, manual push test (OVR-3 — the end-to-end tier).
//!
//! Ignored by default; it requires real Google OAuth credentials (run
//! `org-gdocs auth` first) and network access, so it cannot run in CI. The
//! offline + `mockito` tiers cover the logic and request shapes; this verifies a
//! real round-trip against Google.
//!
//! Run manually:
//!
//! ```sh
//! cargo test -p tftio-org-gdocs --test live_push -- --ignored --nocapture
//! ```
//!
//! Then open the printed document URL and confirm the supported elements render.

use org_gdocs::config::{Config, EnvInputs, Paths};
use org_gdocs::google::client::GoogleClient;
use org_gdocs::{auth, push};

/// The same fixture the offline projection tests can consume (R2 owns it).
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() {
    // Config resolution goes through the sanctioned env edge (OVR-4); no raw env
    // reads in the test itself.
    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());
    // The rewritten file links the doc and carries a regenerated machine region.
    assert!(outcome.new_content.contains("#+GDOC_ID:"));
    assert!(outcome.new_content.contains("* GDOC_METADATA :noexport:"));
    assert!(outcome.new_content.contains("** Sync State"));
}