multiple matches in disjunction
fmieres opened this issue · 2 comments
fmieres commented
Hi! awesome repo!
Is there a way to accept any of possible matches ?
Like in an or condition:
with responses.RequestsMock() as rsps:
rsps.add(
responses.POST,
url,
json={"error": "OK"},
match=[
# any(
matchers.json_params_matcher(body1),
matchers.json_params_matcher(body2)
],
status=200,
)
yield rsps
the currenct code will accept said match if both body1
and body2
match
beliaev-maksim commented
If you use default registry you can add matchers into separate responses
Then it will iterate until matches
fmieres commented
ok, that works. I did that later but just wanted to ask because it might be an improvement. Awesome library. Thanks for all!