File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
scaleway/scaleway/mongodb/v1/tests Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ # MongoDB tests (VCR)
2+
3+ This suite uses VCR cassettes to replay HTTP calls in CI.
4+
5+ How to record locally:
6+
7+ 1 . Ensure you have valid Scaleway credentials exported (access key, secret key, default region).
8+ 2 . Pick a MongoDB instance to target for snapshot creation.
9+ 3 . Temporarily replace the fixed ` instance_id ` in ` test_custom_api.py ` with your instance id or set breakpoints to inject it.
10+ 4 . Run the specific test once to record the cassette:
11+
12+ ``` bash
13+ pytest -k test_create_snapshot_with_naive_expires_at_vcr
14+ ```
15+
16+ 5 . Commit the generated cassette file:
17+ - Path: ` scaleway/scaleway/mongodb/v1/tests/cassettes/test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml `
18+
19+ Notes:
20+ - The test will skip in CI if the cassette file is missing.
21+ - After recording, restore the fixed ` instance_id ` value used by the test to keep requests stable across replays.
Original file line number Diff line number Diff line change 11from datetime import datetime , timedelta , timezone
2+ from pathlib import Path
23
34import pytest
45
1213
1314@scw_vcr .use_cassette
1415def test_create_snapshot_with_naive_expires_at_vcr () -> None :
16+ cassette = (
17+ Path (__file__ ).with_name ("cassettes" )
18+ / "test_create_snapshot_with_naive_expires_at_vcr.cassette.yaml"
19+ )
20+ if not cassette .exists ():
21+ pytest .skip ("cassette not recorded yet; record locally then commit it" )
1522 client = initialize_client_test ()
1623 api = MongodbUtilsV1API (client , bypass_validation = True )
1724
You can’t perform that action at this time.
0 commit comments