def test_clean_username_invalid(self): UserFactory.create(username='******') user = UserFactory.create(username='******') form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {'username': '******'} with self.assertRaises(ValidationError): form.clean_username()
def test_clean_email_invalid(self): UserFactory.create(email='*****@*****.**') user = UserFactory.create(email='*****@*****.**') form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {'email': '*****@*****.**'} with self.assertRaises(ValidationError): form.clean_email()
def test_clean_username_invalid(self): UserFactory.create(username="******") user = UserFactory.create(username="******") form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {"username": "******"} with self.assertRaises(ValidationError): form.clean_username()
def test_clean_email_new_valid(self): user = UserFactory.create(email='*****@*****.**') form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {'email': '*****@*****.**'} eq_(form.clean_email(), '*****@*****.**')
def test_clean_username_new_valid(self): user = UserFactory.create(username='******') form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {'username': '******'} eq_(form.clean_username(), 'bar')
def test_clean_email_new_valid(self): user = UserFactory.create(email="*****@*****.**") form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {"email": "*****@*****.**"} eq_(form.clean_email(), "*****@*****.**")
def test_clean_username_new_valid(self): user = UserFactory.create(username="******") form = UserProfileAdminForm(None, instance=user.userprofile) form.cleaned_data = {"username": "******"} eq_(form.clean_username(), "bar")