ovh / venom

🐍 Manage and run your integration tests with efficiency - Venom run executors (script, HTTP Request, web, imap, etc... ) and assertions
Apache License 2.0
1.06k stars 144 forks source link

Create a new assertion ShouldJsonContain for arrays #746

Closed floriancazals closed 11 months ago

floriancazals commented 1 year ago

I have the following case, an array baz containing two elements. Each of the element is an object with the attribute attr For example:

{
        "baz": [
                {
                        "attr": "foo"
                },
                {
                        "attr": "bar"
                }
        ]
}

I would like to make an assertion like this one

        assertions:
        - result.bodyjson.baz.attr ShouldJsonContain foo

Avoiding to have to specify the index of the array which.

Indeed the attrubute foo may be on index 1 instead of index 0 in my case.

yesnault commented 11 months ago

done