kbase / dts

A data transfer service
https://kbase.github.io/dts/
MIT License
0 stars 0 forks source link

Migrate JAMO-related VCR code out of DTS production code and into test code #53

Closed jeff-cohere closed 5 months ago

jeff-cohere commented 6 months ago

@ialarmedalien sez (in #52):

Since the VCR stuff is concerned with testing, can the VCR-related code just appear in the test files, rather than here in the main codebase?

I don't know how the go version of VCR is set up, but in the python version I create a 'context' for whatever functions or methods I'm testing within the test itself, e.g.

    with vcr.use_cassette(
        "test/data/cassettes/fetch_objects_by_ref.yaml"
    ):
        output = data_fetcher.fetch_objects_by_ref(ref_list)

All the VCR settings are configured within the test suite and VCR is only active when the tests are running. The python VCR has request-matching capabilities so I can store the responses from a series of requests in a single file and the VCR module returns the appropriate response for the given request.