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

Add support for django.contrib.auth.forms.UsernameField #3419

Merged
merged 12 commits into from Jul 25, 2022
Merged

Add support for django.contrib.auth.forms.UsernameField #3419

merged 12 commits into from Jul 25, 2022

Conversation

ajcerejeira
Copy link
Contributor

@ajcerejeira ajcerejeira commented Jul 22, 2022

django.contrib.auth.forms defines two form fields, UsernameField and ReadOnlyPasswordHashField that are used by django admin website.

At the moment hypothesis does not define a default strategy for UsernameField so this MR adds that support by reusing the same strategy for CharField.

Partial fix for #3417. Incorporates and closes #3420, incorporates and closes #3421 - neither really need a separate release.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Looks like a great start - thanks so much for contributing!

Remaining things: add yourself to the list in AUTHORS.rst, ReadOnlyPasswordHashField support, and adding a hypothesis-python/RELEASE.rst:

RELEASE_TYPE: minor

:func:`~hypothesis.extra.django.from_field` now supports
:class:`~django.contrib.auth.forms.UsernameField` and
:class:`~django.contrib.auth.forms.ReadOnlyPasswordHashField`
from ``django.contrib.auth.forms``.

Thanks to Afonso Silva for reporting and fixing :issue:`3417`.

@ajcerejeira
Copy link
Contributor Author

Thanks @Zac-HD, I've added myself to the authors list and added a release file.
About ReadOnlyPasswordHashField, this PR already includes support for that, i.e, this field was already working for hypothesis, I simply added a form test to ensure it anyway.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Looks good to me! Once we work out why this broke the docs build (and unbreak it), I'll merge 🎉

And then we can take a look at the other points in #3417 😁

hypothesis-python/RELEASE.rst Outdated Show resolved Hide resolved
ajcerejeira and others added 6 commits July 23, 2022 11:27
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
There is a small typo in hypothesis-python/src/hypothesis/internal/conjecture/dfa/lstar.py.

Should read `organising` rather than `organisating`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
Turns out that Django doesn't have reference docs for UsernameField.
@Zac-HD
Copy link
Member

Zac-HD commented Jul 25, 2022

Thanks again @ajcerejeira!

@Zac-HD Zac-HD merged commit 2ace082 into HypothesisWorks:master Jul 25, 2022
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.

None yet

4 participants