55import pytest
66
77from vcr_config import scw_vcr
8+ from vcr_config import PYTHON_UPDATE_CASSETTE
89from tests .utils import initialize_client_test
910from scaleway .mongodb .v1 .custom_api import MongodbUtilsV1API
1011
@@ -18,13 +19,18 @@ def test_create_snapshot_with_naive_expires_at_vcr() -> None:
1819 Path (__file__ ).with_name ("cassettes" )
1920 / "test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml"
2021 )
21- if not cassette .exists () and not os .getenv ("PYTHON_UPDATE_CASSETTES " ):
22- pytest .skip ("cassette not recorded yet; set PYTHON_UPDATE_CASSETTES =true to record" )
22+ if not cassette .exists () and not os .getenv ("PYTHON_UPDATE_CASSETTE " ):
23+ pytest .skip ("cassette not recorded yet; set PYTHON_UPDATE_CASSETTE =true to record" )
2324 client = initialize_client_test ()
2425 api = MongodbUtilsV1API (client , bypass_validation = True )
2526
26- # Fixed value to match cassette; record once locally, then CI replays
27- instance_id = "dd5cd838-525b-4395-b2ae-4dec3381ceaf"
27+ # During recording, require a real instance_id via env; during replay, use the fixed value matching the cassette
28+ if PYTHON_UPDATE_CASSETTE :
29+ instance_id = os .getenv ("SCW_TEST_MONGODB_INSTANCE_ID" )
30+ if not instance_id :
31+ pytest .skip ("SCW_TEST_MONGODB_INSTANCE_ID not set while recording" )
32+ else :
33+ instance_id = "00000000-0000-0000-0000-000000000000"
2834
2935 # Naive datetime should be handled as UTC by the utils API
3036 naive_dt = datetime .now ().replace (tzinfo = None ) + timedelta (days = 1 )
0 commit comments