mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 10:59:17 +02:00
Fix #883: Prevent usage of too weak passwords
This commit is contained in:
parent
def555bd50
commit
f44abfecfb
6 changed files with 91 additions and 13 deletions
|
@ -4,7 +4,11 @@ from funkwhale_api.users.admin import MyUserCreationForm
|
|||
def test_clean_username_success(db):
|
||||
# Instantiate the form with a new username
|
||||
form = MyUserCreationForm(
|
||||
{"username": "alamode", "password1": "123456", "password2": "123456"}
|
||||
{
|
||||
"username": "alamode",
|
||||
"password1": "thisismypassword",
|
||||
"password2": "thisismypassword",
|
||||
}
|
||||
)
|
||||
# Run is_valid() to trigger the validation
|
||||
valid = form.is_valid()
|
||||
|
@ -19,7 +23,11 @@ def test_clean_username_false(factories):
|
|||
user = factories["users.User"]()
|
||||
# Instantiate the form with the same username as self.user
|
||||
form = MyUserCreationForm(
|
||||
{"username": user.username, "password1": "123456", "password2": "123456"}
|
||||
{
|
||||
"username": user.username,
|
||||
"password1": "thisismypassword",
|
||||
"password2": "thisismypassword",
|
||||
}
|
||||
)
|
||||
# Run is_valid() to trigger the validation, which is going to fail
|
||||
# because the username is already taken
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue