def test_validate_raises(self): field = EmailField(required=True, default='test') self.assertRaises(SerializerFieldValueError, field.validate) field = EmailField(required=True) field.set_value('test.test.de') self.assertRaises(SerializerFieldValueError, field.validate)
def test_set_value(self): field = EmailField(required=True) field.set_value('*****@*****.**') field.validate() self.assertEqual(field.to_python(), '*****@*****.**') self.assertEqual(field.to_native(), '*****@*****.**')