Skip to content

Commit

Permalink
Merge pull request #18344 from davelopez/24.1_fix_typing_index_users
Browse files Browse the repository at this point in the history
[24.1] Fix typing issue in reused variable
  • Loading branch information
davelopez authored Jun 7, 2024
2 parents 3a3bbfb + 28e0a5b commit d0f01af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 2 additions & 4 deletions lib/galaxy/webapps/galaxy/services/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,7 @@ def get_index(
for key, value in user_dict.items():
if key in expose_keys:
limited_user[key] = value
user = LimitedUserModel(**limited_user)
rval.append(LimitedUserModel(**limited_user))
else:
user = UserModel(**user_dict)

rval.append(user)
rval.append(UserModel(**user_dict))
return rval
15 changes: 9 additions & 6 deletions test/integration/test_users.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
from typing import ClassVar
from typing import (
ClassVar,
Set,
)

from galaxy_test.driver import integration_util

USER_SUMMARY_KEYS = set(["model_class", "id", "email", "username", "deleted", "active", "last_password_change"])
USER_SUMMARY_KEYS: Set[str] = {"model_class", "id", "email", "username", "deleted", "active", "last_password_change"}


class UsersIntegrationCase(integration_util.IntegrationTestCase):
expose_user_name: ClassVar[bool]
expose_user_email: ClassVar[bool]
expected_regular_user_list_count: ClassVar[int]
expected_limited_user_keys: ClassVar[set]
expected_limited_user_keys: ClassVar[Set[str]]

@classmethod
def handle_galaxy_config_kwds(cls, config):
Expand Down Expand Up @@ -57,7 +60,7 @@ class TestExposeUsersIntegration(UsersIntegrationCase):
expose_user_email = True

# Since we allow to expose user information, all users are returned.
expected_limited_user_keys = set(["id", "username", "email"])
expected_limited_user_keys = {"id", "username", "email"}
expected_regular_user_list_count = 3


Expand All @@ -67,7 +70,7 @@ class TestExposeOnlyUserNameIntegration(UsersIntegrationCase):

# When only username is exposed, only that field is returned in the user list.
# Since we are exposing user information, all users are returned.
expected_limited_user_keys = set(["id", "username"])
expected_limited_user_keys = {"id", "username"}
expected_regular_user_list_count = 3


Expand All @@ -77,7 +80,7 @@ class TestExposeOnlyUserEmailIntegration(UsersIntegrationCase):

# When only email is exposed, only that field is returned in the user list.
# Since we are exposing user information, all users are returned.
expected_limited_user_keys = set(["id", "email"])
expected_limited_user_keys = {"id", "email"}
expected_regular_user_list_count = 3


Expand Down

0 comments on commit d0f01af

Please sign in to comment.