class ProEmailFieldTestCase(unittest.TestCase, FormFieldTestCase): def setUp(self): #pass along a list of excluded domains upon instantiation self.formfield = ProEmailField(['gmail', 'yahoo']) def test_clean_fails(self): self.assertRaises(ValidationError, self.formfield.clean,'*****@*****.**') def test_clean_passes(self): #if value validates, clean must return the value self.assertEqual(self.formfield.clean('*****@*****.**'), u'*****@*****.**')
def setUp(self): #pass along a list of excluded domains upon instantiation self.formfield = ProEmailField(['gmail', 'yahoo'])