diff --git a/tests/gmail_message_list_integration.rs b/tests/gmail_message_list_integration.rs new file mode 100644 index 0000000..52c5cdf --- /dev/null +++ b/tests/gmail_message_list_integration.rs @@ -0,0 +1,36 @@ +// Optional integration test for Gmail API interactions. +// +// This test is ignored by default to avoid network use in CI. +// To run locally, ensure you have valid OAuth client credentials and set up +// the configuration as required by `ClientConfig`. +// +// Example to run: +// cargo test --test gmail_message_list_integration -- --ignored + +use cull_gmail::{ClientConfig, GmailClient, MessageList, Result}; + +#[ignore] +#[tokio::test] +async fn list_first_page_of_messages_smoke_test() -> Result<()> { + // Configure with your own credentials before running locally. + let config = ClientConfig::builder() + // .with_config_base(&cull_gmail::client_config::config_root::RootBase::Home) + // .with_config_path(".cull-gmail") + // .with_credential_file("client_secret.json") + // Alternatively specify client_id/client_secret and related fields: + // .with_client_id("") + // .with_client_secret("") + .build(); + + let mut client = GmailClient::new_with_config(config).await?; + + // Configure a conservative query to avoid heavy traffic + client.set_query("in:inbox newer_than:30d"); + client.set_max_results(10); + + // Should complete without error; results may be empty depending on mailbox + client.get_messages(1).await?; + let _ids = client.message_ids(); + + Ok(()) +}