mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Added test for ModelSerializer Meta fields
returning as expected
This commit is contained in:
parent
1b49615c00
commit
38af6107b5
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user