Skip to content

Instantly share code, notes, and snippets.

@bmispelon
Created November 24, 2012 12:50
Show Gist options
  • Select an option

  • Save bmispelon/4139543 to your computer and use it in GitHub Desktop.

Select an option

Save bmispelon/4139543 to your computer and use it in GitHub Desktop.
Test for django ticket #19353
from django.contrib.auth.tests.custom_user import ExtensionUser
from django.contrib.auth.forms import UserCreationForm
from django.test import TestCase
from django.test.utils import override_settings
class CustomUserCreationForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
model = ExtensionUser
class CustomUserCreationFormTest(TestCase):
@override_settings(AUTH_USER_MODEL='auth.ExtensionUser')
def test_form_validates(self):
data = {
'username': 'jsmith',
'password1': 'test123',
'password2': 'test123',
}
form = CustomUserCreationForm(data)
self.assertTrue(form.is_valid())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment