Add VCR cassette re-recording tooling - #331
Conversation
11d02e0 to
02fc8c7
Compare
02fc8c7 to
82f1dd6
Compare
| print("== Preparing fixtures and applying UUID substitutions ==") | ||
| if prepare_fixtures() != 0: | ||
| print("Fixture preparation failed; aborting.") | ||
| return 1 | ||
|
|
||
| for module, cassette_dir, names in MODULES: | ||
| print(f"\n== Recording {module} ==") | ||
|
|
||
| # Reset the fixture's tags to baseline before each module. | ||
| if prepare_fixtures() != 0: | ||
| print("Fixture reset failed; aborting.") | ||
| return 1 |
There was a problem hiding this comment.
| print("== Preparing fixtures and applying UUID substitutions ==") | |
| if prepare_fixtures() != 0: | |
| print("Fixture preparation failed; aborting.") | |
| return 1 | |
| for module, cassette_dir, names in MODULES: | |
| print(f"\n== Recording {module} ==") | |
| # Reset the fixture's tags to baseline before each module. | |
| if prepare_fixtures() != 0: | |
| print("Fixture reset failed; aborting.") | |
| return 1 | |
| print("== Preparing fixtures and applying UUID substitutions ==") | |
| for module, cassette_dir, names in MODULES: | |
| print(f"\n== Recording {module} ==") | |
| # Reset the fixture's tags to baseline before each module. | |
| if prepare_fixtures() != 0: | |
| print("Fixture reset failed; aborting.") | |
| return 1 |
| def run(cmd, env=None): | ||
| print(f"\n$ {' '.join(cmd)}", flush=True) | ||
| return subprocess.run(cmd, cwd=ROOT, env=env).returncode | ||
|
|
||
|
|
||
| def prepare_fixtures(): | ||
| return run([sys.executable, str(PREPARE)]) | ||
|
|
||
|
|
||
| def main(): | ||
| pub_key = os.environ.get("UPLOADCARE_PUBLIC_KEY", "") |
| @@ -0,0 +1,11 @@ | |||
| { | |||
| "pub_key": "27f2cfb68ead78acd3a5", | |||
There was a problem hiding this comment.
I understand that's a public project key, but I guess it's not what exactly we want to store in our public library: Upload API is not protected, for this test project secure uploads disabled -> anybody can upload to this project.
Not critical, but it's potential vulnerability point.
I suggest to keep not a key, but fingerprint, and comparing hexed value:
pyuploadcare/scripts/prepare_vcr_fixtures.py
Lines 179 to 188 in 02fc8c7
| {"album": "summer sunset"}, | ||
| ), | ||
| ("no_tags", "no-tags.txt", True, None, None), | ||
| ("sunset_2", "sunset-beach.jpg", False, ["cat"], None), |
There was a problem hiding this comment.
Why storing is disabled?
pyuploadcare/scripts/vcr_fixtures.json
Lines 1 to 11 in 02fc8c7
There was a problem hiding this comment.
we need this for the search tests.
files can be ephemeral, we onlyh need them to (re)create cassettes.
82f1dd6 to
4dea00d
Compare
Co-authored-by: Claude <noreply@anthropic.com>
fe94aa8 to
c66d1be
Compare
Co-authored-by: Claude <noreply@anthropic.com>
|




Description
Add a script and makefile command to rebuild VCR cassettes.