Closed mihalt closed 1 month ago
By the way, I do this from your docs and it doesn't work. I see debugger breakpoint into pytest_recording_configure, but not in jurassic_matcher
def jurassic_matcher(r1, r2): assert r1.uri == r2.uri and "JURASSIC PARK" in r1.body, \ "required string (JURASSIC PARK) not found in request body"
def pytest_recording_configure(config, vcr): vcr.register_matcher("jurassic", jurassic_matcher)
I've understood how it works. You just should do if globaly then
@pytest.fixture(scope="session")
def vcr_config():
return {
"match_on": ["jurassic"],
"record_mode": "once"
}
It is important to have this record_mode
and already done casset of request.
Would be good to mention this in the docs.
And for before_record
you can do
@pytest.fixture(scope="session")
def vcr_config():
return {
"before_record_request": before_record_cb,
"before_record_response": clean_response,
}
I try to imitate this behaviour. How can I do it with pytest-recording?
By the way, I do this from your docs and it doesn't work. I see debugger breakpoint into
pytest_recording_configure
, but not injurassic_matcher