def test_valid_signup(self): data = {'name':'Nanda Kishore', 'password':'******', 'email':'*****@*****.**', 'company':'MGIT.'} form = EmployeeSignupForm(data) self.assertTrue(form.is_valid()) self.assertFalse(form.errors) self.assertTrue(hasattr(form, 'cleaned_data'))
def test_duplicate_signup(self): data = {'name':'Nanda Kishore', 'password':'******', 'email':'*****@*****.**', 'company':'Infosys'} form = EmployeeSignupForm(data) self.assertFalse(form.is_valid()) self.assertTrue(form.errors) self.assertTrue(form.errors.has_key('email')) self.assertFalse(hasattr(form, 'cleaned_data'))
def test_invalid_signup(self): data = {'name':'', 'password':'', 'email':'', 'company':''} form = EmployeeSignupForm(data) self.assertFalse(form.is_valid()) self.assertTrue(form.errors) self.assertTrue(form.errors.has_key('name')) self.assertTrue(form.errors.has_key('email')) self.assertTrue(form.errors.has_key('password')) self.assertTrue(form.errors.has_key('company'))