mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-10 16:12:29 +03: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,4 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from {{ cookiecutter.project_slug }}.users.forms import UserCreationForm
|
from {{ cookiecutter.project_slug }}.users.forms import UserCreationForm
|
||||||
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
|
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
|
||||||
|
@ -37,3 +38,4 @@ class TestUserCreationForm:
|
||||||
assert not form.is_valid()
|
assert not form.is_valid()
|
||||||
assert len(form.errors) == 1
|
assert len(form.errors) == 1
|
||||||
assert "username" in form.errors
|
assert "username" in form.errors
|
||||||
|
assert form.errors["username"][0] == _("This username has already been taken.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user