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

Use UserAttrsProxy as last resort in build_initial_user (#259) #269

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

apragacz
Copy link
Owner

@apragacz apragacz commented Sep 24, 2023

Checklist

  • I read Contribution Guidelines
  • I ran the checks and the tests (make check && make test) before submitting the PR on my branch and they passed
  • I attached unit tests testing the provided code so the code coverage will not drop below 98%

Description

This change modifies build_initial_user which is required for password validation with the following logic:

  1. Try to use the provided model with given attributes (previous behavior)
  2. If that fails, because e.g. there is custom deserialization for nested elements then use UserAttrsProxy which will just pass the given attributes to validator function via "magic" object.

In most cases of password validation, we will only care about fields like username in that case, so the format of other fields will not affect that logic.

Why the change is needed?

This change is required to solve #259.

Related issues, pull requests, links

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2023

Codecov Report

Merging #269 (af941ac) into master (bd2fa9c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@           Coverage Diff           @@
##           master     #269   +/-   ##
=======================================
  Coverage   98.14%   98.15%           
=======================================
  Files          44       44           
  Lines        1562     1570    +8     
  Branches      155      155           
=======================================
+ Hits         1533     1541    +8     
  Misses         16       16           
  Partials       13       13           
Files Changed Coverage Δ
rest_registration/utils/users.py 95.93% <100.00%> (+0.17%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@apragacz apragacz mentioned this pull request Oct 27, 2023
@apragacz apragacz merged commit f6cec0a into master Oct 30, 2023
2 checks passed
@apragacz apragacz deleted the issue-259-user-attrs-proxy branch October 30, 2023 10:23
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.

2 participants