'How to check whether one node in API response has same value under all object using postman tests?

Suppose a API request fetches a users id, email address and their designated role. Sample API Request below:

GET: /v1/users HTTP/1.1
Content-Type: application/json
Authorization: bearer {access_token}

For the above request, the following is the response:

{
    "content": [
        {
            "id": 1,
            "email": "[email protected]",
            "full_name": "AlbusDumbledore",
            "role": "OWNER"
        },
        {
            "id": 40,
            "email": "[email protected]",
            "role": "OWNER"
        }
],
    "last": false,
    "total_elements": 2,
    "total_pages": 1,
    "sort": null,
    "first": true,
    "number_of_elements": 2,
    "size": 20,
    "number": 0
}

Now, what will be the test in postman to make sure that all the returned values under role node is equal to OWNER?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source