mirror of
https://github.com/Hopiu/cookiecutter-django.git
synced 2026-05-11 06:03:09 +00:00
Updated the test_clean_username test to also test for the custom validation message raised in case username already exists in the db
This commit is contained in:
parent
0a241a8f75
commit
e8996ef281
1 changed files with 2 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from {{ cookiecutter.project_slug }}.users.forms import UserCreationForm
|
||||
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
|
||||
|
|
@ -37,3 +38,4 @@ class TestUserCreationForm:
|
|||
assert not form.is_valid()
|
||||
assert len(form.errors) == 1
|
||||
assert "username" in form.errors
|
||||
assert form.errors["username"][0] == _("This username has already been taken.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue