Skip to content

Commit

Permalink
Fix test_search_users (#287)
Browse files Browse the repository at this point in the history
### Description

Fixed test_users::test_search_users.
When there were more than 10 users in the students group, it would fail
because it would try to compare all of the users from the group to the
users returned by an endpoint that is limited to return up to 10 users
only.
I've modified the test so that instead of a strict equality, it is now
an inequality, meaning that the students returned by /users/search must
be present in the group, but we don't need all of them

### Checklist

- [x] All tests passing
  • Loading branch information
Pokegali authored Nov 9, 2023
1 parent a59d54e commit c1d2168
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ def test_search_users():
)
assert response.status_code == 200
data_users = set(user["id"] for user in response.json())
assert data_users == group_users
assert (
data_users <= group_users
) # This endpoint is limited to 10 members, so we only need an inclusion between the two sets, in case there are more than 10 members in the group.

response = client.get(
f"/users/search?query=&excludedGroups={group}",
Expand Down

0 comments on commit c1d2168

Please sign in to comment.