Skip to content

Commit

Permalink
fix: crash for count users query (#1649)
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-olivier authored Feb 7, 2024
1 parent 64dec2f commit ad34fe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/kili/adapters/kili_api_gateway/user/operation_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def list_users(

def count_users(self, user_filters: UserFilter) -> int:
"""Return the number of users that match the filter."""
result = self.graphql_client.execute(GQL_COUNT_USERS, user_where_mapper(user_filters))
variables = {"where": user_where_mapper(user_filters)}
result = self.graphql_client.execute(GQL_COUNT_USERS, variables)
return result["data"]

def get_current_user(self, fields: ListOrTuple[str]) -> Dict:
Expand Down
14 changes: 8 additions & 6 deletions tests/integration/adapters/kili_api_gateway/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ def test_given_kili_gateway_when_querying_count_users_it_calls_proper_resolver(
graphql_client.execute.assert_called_once_with(
GQL_COUNT_USERS,
{
"activated": None,
"apiKey": None,
"email": None,
"id": "fake_user_id",
"idIn": None,
"organization": {"id": None},
"where": {
"activated": None,
"apiKey": None,
"email": None,
"id": "fake_user_id",
"idIn": None,
"organization": {"id": None},
}
},
)

Expand Down

0 comments on commit ad34fe0

Please sign in to comment.