def test_username_regex_rule(self): ''' Test username abides by set regex rule ''' self.entries['username'] = '******' form = RegistrationForm(data=self.entries) self.assertFalse(form.is_valid()) with self.assertRaises(forms.ValidationError): form.clean_username()
def test_unique_username(self): ''' Test only unique usernames accepted ''' self.entries['username'] = '******' form = RegistrationForm(data=self.entries) self.assertFalse(form.is_valid()) with self.assertRaises(forms.ValidationError): form.clean_username()