mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 12:00:12 +03:00
Merge c513eaa213
into 00b1877106
This commit is contained in:
commit
8ae3c1cb98
|
@ -1809,7 +1809,7 @@ class SerializerDefaultTrueBoolean(TestCase):
|
|||
self.assertEqual(serializer.data['dog'], False)
|
||||
|
||||
|
||||
class BoolenFieldTypeTest(TestCase):
|
||||
class BooleanFieldTypeTest(TestCase):
|
||||
'''
|
||||
Ensure the various Boolean based model fields are rendered as the proper
|
||||
field type
|
||||
|
@ -1840,3 +1840,20 @@ class BoolenFieldTypeTest(TestCase):
|
|||
'''
|
||||
bfield = self.serializer.get_fields()['started']
|
||||
self.assertEqual(type(bfield), fields.BooleanField)
|
||||
|
||||
|
||||
class SerializerMixin(object):
|
||||
data = serializers.SerializerMethodField('get_data')
|
||||
|
||||
def get_data(self, obj):
|
||||
return 'My data'
|
||||
|
||||
|
||||
class SerializerWithMixin(SerializerMixin, serializers.Serializer):
|
||||
pass
|
||||
|
||||
|
||||
class SerializerMixinTest(TestCase):
|
||||
def test_mixin_field(self):
|
||||
serializer = SerializerWithMixin()
|
||||
self.assertIn('data', serializer.base_fields)
|
||||
|
|
Loading…
Reference in New Issue
Block a user