Blacked the code

This commit is contained in:
Eliot Berriot 2018-06-09 15:36:16 +02:00
parent b6fc0051fa
commit 62ca3bd736
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
279 changed files with 8861 additions and 9527 deletions

View file

@ -3,28 +3,24 @@ 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',
})
form = MyUserCreationForm(
{"username": "alamode", "password1": "123456", "password2": "123456"}
)
# Run is_valid() to trigger the validation
valid = form.is_valid()
assert valid
# Run the actual clean_username method
username = form.clean_username()
assert 'alamode' == username
assert "alamode" == username
def test_clean_username_false(factories):
user = factories['users.User']()
user = factories["users.User"]()
# Instantiate the form with the same username as self.user
form = MyUserCreationForm({
'username': user.username,
'password1': '123456',
'password2': '123456',
})
form = MyUserCreationForm(
{"username": user.username, "password1": "123456", "password2": "123456"}
)
# Run is_valid() to trigger the validation, which is going to fail
# because the username is already taken
valid = form.is_valid()
@ -32,4 +28,4 @@ def test_clean_username_false(factories):
# The form.errors dict should contain a single error called 'username'
assert len(form.errors) == 1
assert 'username' in form.errors
assert "username" in form.errors