behat-api-extension icon indicating copy to clipboard operation
behat-api-extension copied to clipboard

New step: "Then the response body does not contain JSON"

Open milkovsky opened this issue 3 years ago • 4 comments

Missing a step to verify, that data does not exist in the API response.

milkovsky avatar Nov 11 '21 16:11 milkovsky

So basically something like:

Then the response body is empty

?

christeredvartsen avatar Nov 14 '21 09:11 christeredvartsen

@christeredvartsen the response body may be non-empty. I want to check, whether the JSON body contains a specific value. For example:

Then the response body does not contain JSON
"""
{
  "foo": "bar"
}
"""

milkovsky avatar Nov 14 '21 23:11 milkovsky

Ah, I see.

I can try to implement a step that does something like this and see how it ends up. I can have something testable in a few days.

christeredvartsen avatar Nov 15 '21 10:11 christeredvartsen

@christeredvartsen I added a small PR with a proof of concept.

milkovsky avatar Nov 22 '21 12:11 milkovsky