Commit 0f77c27d by Tom Christie

Merge branch 'master' of https://github.com/callorico/django-rest-framework into callorico-master

parents 75be9191 bc6bf723
...@@ -344,6 +344,22 @@ class TestDurationFieldMapping(TestCase): ...@@ -344,6 +344,22 @@ class TestDurationFieldMapping(TestCase):
self.assertEqual(unicode_repr(TestSerializer()), expected) self.assertEqual(unicode_repr(TestSerializer()), expected)
class TestGenericIPAddressFieldValidation(TestCase):
def test_ip_address_validation(self):
class IPAddressFieldModel(models.Model):
address = models.GenericIPAddressField()
class TestSerializer(serializers.ModelSerializer):
class Meta:
model = IPAddressFieldModel
s = TestSerializer(data={'address': 'not an ip address'})
self.assertFalse(s.is_valid())
self.assertEquals(1, len(s.errors['address']),
'Unexpected number of validation errors: '
'{0}'.format(s.errors))
# Tests for relational field mappings. # Tests for relational field mappings.
# ------------------------------------ # ------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment