Skip to content

Commit 0ad55ad

Browse files
committed
feat: add OVERWRITE for cassettes
risk: nonprod
1 parent 6476b5f commit 0ad55ad

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests-support/tests_support/vcrpy_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
from __future__ import annotations
33

44
import json
5+
import os
56
import typing
67
from json import JSONDecodeError
78
from typing import Any, Optional
89

910
import vcr
1011
import yaml
12+
from vcr.record_mode import RecordMode
1113

1214
VCR_MATCH_ON = ("method", "scheme", "host", "port", "path", "query", "body")
1315
NON_STATIC_HEADERS = ["DATE", "X-GDC-TRACE-ID"]
@@ -22,6 +24,7 @@ def get_vcr() -> vcr.VCR:
2224
before_record_request=custom_before_request,
2325
before_record_response=custom_before_response,
2426
decode_compressed_response=True,
27+
record_mode=RecordMode.ALL if "OVERWRITE" in os.environ else RecordMode.ONCE,
2528
)
2629

2730
gd_vcr.register_serializer("custom", CustomSerializerYaml())

0 commit comments

Comments
 (0)