Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON subset matching #133

Open
sarayourfriend opened this issue Jun 21, 2024 · 0 comments
Open

JSON subset matching #133

sarayourfriend opened this issue Jun 21, 2024 · 0 comments

Comments

@sarayourfriend
Copy link
Collaborator

It would be nice to be able to match request body JSON using an expected subset of the data. Something like:

(pook.post(url)
    .json({"id": identifier}, subset=True)
    .reply(200))

As a way to match a larger request body that's:

{
  "id": ...,
  "created_on": ...,
  "updated_on": ...,
  "other_property_irrelevant_to_the_test": ...,
}

Right now the only way to do this is using a regex pattern with the body matcher, but that's pretty tedious, especially if you have multiple subset properties you want to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant