Changes between Version 1 and Version 2 of Ticket #36140, comment 9


Ignore:
Timestamp:
Jan 29, 2025, 5:59:55 AM (2 weeks ago)
Author:
Gregory Mariani

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36140, comment 9

    v1 v2  
    44{{{
    55    def test_empty_passwords_with_required_false(self):
     6        class CustomUserCreationForm(UserCreationForm):
     7            password1 = CharField(required=False)
     8            password2 = CharField(required=False)
     9
     10            class Meta(UserCreationForm.Meta):
     11                model = ExtensionUser
     12                fields = UserCreationForm.Meta.fields + ("date_of_birth",)
     13
    614        form_data = {
    715            "username": "testuser",
    816            # 'password1' et 'password2' are not given
    917        }
    10         form = self.form_class(data=form_data)
    11         self.assertTrue(form.is_valid())
     18        form = CustomUserCreationForm(data=form_data)
     19        self.assertFalse(form.is_valid())
    1220        self.assertNotIn("password1", form.errors)
    1321        self.assertNotIn("password2", form.errors)
Back to Top