Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] remove random password generation when creating a user and password is not provided #4993

Merged
merged 4 commits into from
Jun 12, 2024

Conversation

jfcalvo
Copy link
Member

@jfcalvo jfcalvo commented Jun 11, 2024

Description

This PR remove the generation of a random password when a user is created a password is not provided.

With these changes when a user is created and no password is provided a UnprocessableEntityError will be raised from the backend showing that a password attribute must be provided.

Closes #4933

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)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (change restructuring the codebase without changing functionality)
  • Improvement (change adding some improvement to an existing functionality)
  • Documentation update

How Has This Been Tested

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

  • Adding new tests and checking that old ones are working.

Checklist

  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • 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 (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@jfcalvo jfcalvo linked an issue Jun 11, 2024 that may be closed by this pull request
@burtenshaw burtenshaw changed the title feat: remove random password generation when creating a user and password is not provided [FEATURE] remove random password generation when creating a user and password is not provided Jun 11, 2024
Copy link
Contributor

@burtenshaw burtenshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me just one extra test we could use.

@@ -35,6 +35,11 @@ def test_create_user(self, client: Argilla):
assert user.id is not None
assert client.users(username=user.username).id == user.id

def test_create_user_without_password(self, client: Argilla):
user = User(username="test_user")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also test on retrieving an existing user via client.users("existing_user")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test with your suggestion. Please can you take a look to it?

Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.90%. Comparing base (ab22637) to head (93bcb0c).
Report is 3 commits behind head on feat/v2.0.0.

Additional details and impacted files
@@               Coverage Diff               @@
##           feat/v2.0.0    #4993      +/-   ##
===============================================
- Coverage        60.92%   60.90%   -0.02%     
===============================================
  Files              329      329              
  Lines            17674    17674              
===============================================
- Hits             10767    10765       -2     
- Misses            6907     6909       +2     
Flag Coverage Δ
argilla 45.92% <ø> (-0.02%) ⬇️
argilla-server 91.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jfcalvo jfcalvo merged commit a667a90 into feat/v2.0.0 Jun 12, 2024
24 of 26 checks passed
@jfcalvo jfcalvo deleted the feat/avoid-sdk-user-random-password-generation branch June 12, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[QUESTION] Regarding password of user
3 participants