From e8996ef281ada2dab4188f2eff1435d2a694f50c Mon Sep 17 00:00:00 2001 From: Arnav Choudhury Date: Sat, 30 Jan 2021 11:41:16 +0530 Subject: [PATCH] Updated the test_clean_username test to also test for the custom validation message raised in case username already exists in the db --- .../{{cookiecutter.project_slug}}/users/tests/test_forms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py index 3b4a1210c..437829b25 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_forms.py @@ -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.")