@@ -3612,13 +3612,58 @@ def test_s3_destination():
3612
3612
)
3613
3613
3614
3614
3615
- @pytest .mark .parametrize ("stripe_table" , ["subscription" , "customer" , "charge" ])
3616
- def test_stripe_source (stripe_table ):
3615
+ @pytest .mark .parametrize (
3616
+ "stripe_table" ,
3617
+ [
3618
+ "subscription" ,
3619
+ "customer" ,
3620
+ "product" ,
3621
+ "price" ,
3622
+ "event" ,
3623
+ "invoice" ,
3624
+ "charge" ,
3625
+ "balancetransaction" ,
3626
+ ],
3627
+ )
3628
+ def test_stripe_source_full_refresh (stripe_table ):
3629
+ # Get Stripe token from environment
3630
+ stripe_token = os .environ .get ("INGESTR_TEST_STRIPE_TOKEN" )
3631
+ if not stripe_token :
3632
+ pytest .skip ("INGESTR_TEST_STRIPE_TOKEN not set" )
3633
+
3634
+ # Create test database
3635
+ dbname = f"test_stripe_{ stripe_table } { get_random_string (5 )} .db"
3636
+ abs_db_path = get_abs_path (f"./testdata/{ dbname } " )
3637
+ rel_db_path_to_command = f"ingestr/testdata/{ dbname } "
3638
+ uri = f"duckdb:///{ rel_db_path_to_command } "
3639
+
3640
+ conn = duckdb .connect (abs_db_path )
3641
+
3642
+ # Run ingest command
3643
+ result = invoke_ingest_command (
3644
+ f"stripe://{ stripe_table } s?api_key={ stripe_token } " ,
3645
+ stripe_table ,
3646
+ uri ,
3647
+ f"raw.{ stripe_table } s" ,
3648
+ )
3649
+
3650
+ assert result .exit_code == 0
3651
+
3652
+ # Verify data was loaded
3653
+ res = conn .sql (f"select count(*) from raw.{ stripe_table } s" ).fetchone ()
3654
+ assert res [0 ] > 0 , f"No { stripe_table } records found"
3655
+
3656
+ # Clean up
3617
3657
try :
3618
- shutil . rmtree ( get_abs_path ( "../pipeline_data" ) )
3658
+ os . remove ( abs_db_path )
3619
3659
except Exception :
3620
3660
pass
3621
3661
3662
+
3663
+ @pytest .mark .parametrize (
3664
+ "stripe_table" , ["event" , "invoice" , "charge" , "balancetransaction" ]
3665
+ )
3666
+ def test_stripe_source_incremental (stripe_table ):
3622
3667
# Get Stripe token from environment
3623
3668
stripe_token = os .environ .get ("INGESTR_TEST_STRIPE_TOKEN" )
3624
3669
if not stripe_token :
@@ -3638,6 +3683,8 @@ def test_stripe_source(stripe_table):
3638
3683
stripe_table ,
3639
3684
uri ,
3640
3685
f"raw.{ stripe_table } s" ,
3686
+ interval_start = "2025-04-01" ,
3687
+ interval_end = "2025-05-30" ,
3641
3688
)
3642
3689
3643
3690
assert result .exit_code == 0
0 commit comments