Skip to content

Commit

Permalink
bug: fix bug and update test (#4341)
Browse files Browse the repository at this point in the history
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context. List any dependencies that
are required for this change.

Closes #4340 

**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- [ ] Test A
- [ ] Test B

**Checklist**

- [ ] I followed the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the `CHANGELOG.md` file (See
https://keepachangelog.com/)
  • Loading branch information
sdiazlor authored Nov 28, 2023
1 parent 81f3229 commit f131717
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/argilla/client/feedback/utils/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def assign_workspaces(
except:
pass

wk_assignments[workspace_name] = [User.from_id(user).username for user in workspace.users]
wk_assignments[workspace_name] = [User.from_id(user.id).username for user in workspace.users]

continue

Expand All @@ -257,6 +257,6 @@ def assign_workspaces(
except:
pass

wk_assignments[workspace_name] = [User.from_id(user).username for user in workspace.users]
wk_assignments[workspace_name] = [User.from_id(user.id).username for user in workspace.users]

return wk_assignments
11 changes: 9 additions & 2 deletions tests/unit/client/feedback/utils/test_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ def _factory(*args, **kwargs):
mock = Mock(spec=Workspace)
mock.users = []

def create_mock_user(user_id):
user_mock = Mock()
user_mock.id = user_id
return user_mock

def add_user(user_id):
if user_id not in mock.users:
mock.users.append(user_id)
# Check if a user with this ID already exists in the list
if not any(user.id == user_id for user in mock.users):
mock_user = create_mock_user(user_id)
mock.users.append(mock_user)

mock.add_user.side_effect = add_user

Expand Down

0 comments on commit f131717

Please sign in to comment.