flowglad 0.1.0

Rust SDK for FlowGlad - Open source billing infrastructure
Documentation
//! Integration test helpers and shared setup

use flowglad::{Client, Config};
use once_cell::sync::Lazy;

/// Shared test client using the FlowGlad test API key
///
/// This client connects to the real FlowGlad API using a test key.
/// All integration tests share this client instance.
pub static TEST_CLIENT: Lazy<Client> = Lazy::new(|| {
    let config = Config::new("sk_test_2UpNCeGvC1EuiJASnW2Z2i4Wot7N3goNdogBU4rLFnPqnp");
    Client::new(config).expect("Failed to create test client")
});

/// Generate a unique test email to avoid conflicts
pub fn unique_email(prefix: &str) -> String {
    use std::time::{SystemTime, UNIX_EPOCH};
    let timestamp = SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .unwrap()
        .as_secs();
    format!("{}+{}@flowglad-test.com", prefix, timestamp)
}

/// Generate a unique test name
pub fn unique_name(prefix: &str) -> String {
    use std::time::{SystemTime, UNIX_EPOCH};
    let timestamp = SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .unwrap()
        .as_secs();
    format!("{} {}", prefix, timestamp)
}