dnaeon / go-vcr

Record and replay your HTTP interactions for fast, deterministic and accurate tests
BSD 2-Clause "Simplified" License
1.26k stars 78 forks source link

[recorder] add option to load cassette from embed.Fs #83

Closed johnshiver closed 3 months ago

johnshiver commented 1 year ago

Describe your changes

I want a way to load fixtures from an embedded filesystem, so I can use the recorder for my integration tests but also to create fakes that I use while my process is running (development / sandbox mode / etc)

This PR adds an option to create a recorder with an embedded filesystem, and if set optionally loads the cassette from it.

I didn't spend much time making the code nice, it is a little messy for my taste but it does work. If there is support for the idea Im happy to make any adjustments necessary to get the PR merged.

Checklist before requesting a review

tests pass

dnaeon commented 1 year ago

Hey @johnshiver ,

Thanks for the PR! I'll try to review it tomorrow and provide some feedback. Thanks again!

codecov-commenter commented 1 year ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 48.43750% with 33 lines in your changes missing coverage. Please review.

Project coverage is 73.61%. Comparing base (035acaf) to head (0d189b6). Report is 14 commits behind head on v3.

Files with missing lines Patch % Lines
recorder/recorder.go 48.43% 30 Missing and 3 partials :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v3 #83 +/- ## ========================================== - Coverage 77.69% 73.61% -4.08% ========================================== Files 1 1 Lines 278 326 +48 ========================================== + Hits 216 240 +24 - Misses 48 72 +24 Partials 14 14 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.