Added test for ModelSerializer Meta fields

returning as expected
This commit is contained in:
Jacob Magnusson 2012-11-03 00:32:08 +01:00
parent 1b49615c00
commit 38af6107b5

View File

@ -106,6 +106,14 @@ class BasicTests(TestCase):
self.assertTrue(serializer.object is expected)
self.assertEquals(serializer.data['sub_comment'], 'And Merry Christmas!')
def test_model_fields_as_expected(self):
""" Make sure that the fields returned are the same as defined
in the Meta data
"""
serializer = PersonSerializer(instance=self.person)
self.assertEquals(set(serializer.data.keys()),
set(['name', 'age', 'info']))
def test_field_with_dictionary(self):
""" Make sure that dictionaries from fields are left intact
"""