def test_username_validation_error_msg(self, user: User):
    "\n        Tests UserCreation Form's unique validator functions correctly by testing:\n            1) A new user with an existing username cannot be added.\n            2) Only 1 error is raised by the UserCreation Form\n            3) The desired error message is raised\n        "
    form = UserCreationForm({'username': user.username, 'password1': user.password, 'password2': user.password})
    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.'))
Tests UserCreation Form's unique validator functions correctly by testing:
    1) A new user with an existing username cannot be added.
    2) Only 1 error is raised by the UserCreation Form
    3) The desired error message is raised
def test_username_validation_error_msg(self, user: User):
    "\n        Tests UserCreation Form's unique validator functions correctly by testing:\n            1) A new user with an existing username cannot be added.\n            2) Only 1 error is raised by the UserCreation Form\n            3) The desired error message is raised\n        "
    form = UserCreationForm({'username': user.username, 'password1': user.password, 'password2': user.password})
    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.'))