Example #1
0
    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)
Example #2
0
    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)
Example #3
0
 class TestSerializer(Serializer):
     _type = TypeField('test_type')
     name = StringField(required=True)
     email = EmailField(required=True)
Example #4
0
 def test_hide_on_null(self):
     field = EmailField(required=False, on_null=HIDE_FIELD)
     self.assertRaises(IgnoreField, field.to_native)
     self.assertIsNone(field.to_python())
Example #5
0
 def test_default(self):
     field = EmailField(required=True, default='*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')
Example #6
0
 def test_set_value(self):
     field = EmailField(required=True)
     field.set_value('*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')
Example #7
0
 def test_hide_on_null(self):
     field = EmailField(required=False, on_null=HIDE_FIELD)
     self.assertRaises(IgnoreField, field.to_native)
     self.assertIsNone(field.to_python())
Example #8
0
 def test_default(self):
     field = EmailField(required=True, default='*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')
Example #9
0
 def test_set_value(self):
     field = EmailField(required=True)
     field.set_value('*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')