//! Stripe disconnect workflow tests. use crate::harness::TestHarness; #[tokio::test] async fn stripe_disconnect_requires_auth() { let mut h = TestHarness::new().await; let resp = h.client.delete("/api/users/me/stripe").await; assert!( resp.status.is_client_error() || resp.status.is_redirection(), "Unauthenticated stripe disconnect should be rejected: {} {}", resp.status, resp.text ); } #[tokio::test] async fn stripe_disconnect_succeeds() { let mut h = TestHarness::new().await; let _user_id = h .signup("stripedisc", "stripedisc@test.com", "password123") .await; // User has no Stripe account connected, but disconnect should still succeed gracefully let resp = h.client.delete("/api/users/me/stripe").await; assert!( resp.status.is_success() || resp.status == 204, "Stripe disconnect should succeed: {} {}", resp.status, resp.text ); } #[tokio::test] async fn stripe_disconnect_idempotent() { let mut h = TestHarness::new().await; let _user_id = h .signup("stripetwice", "stripetwice@test.com", "password123") .await; // Disconnect twice, second call should also succeed h.client.delete("/api/users/me/stripe").await; let resp = h.client.delete("/api/users/me/stripe").await; assert!( resp.status.is_success() || resp.status == 204, "Second stripe disconnect should also succeed: {} {}", resp.status, resp.text ); }