mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Fixed tests after introducing 'initial' field to metadata API
Also extended current test to also check against a field with its 'initial' argument set to 'initial value'.
This commit is contained in:
parent
fc0ec571c2
commit
b3abe12ef1
|
@ -130,7 +130,7 @@ class SimpleMetadata(BaseMetadata):
|
|||
|
||||
for attr in attrs:
|
||||
value = getattr(field, attr, None)
|
||||
if value is not None and value != '':
|
||||
if value is not None and value != '' and value != []:
|
||||
field_info[attr] = force_text(value, strings_only=True)
|
||||
|
||||
if getattr(field, 'child', None):
|
||||
|
|
|
@ -69,7 +69,8 @@ class TestMetadata:
|
|||
min_value=1, max_value=1000
|
||||
)
|
||||
char_field = serializers.CharField(
|
||||
required=False, min_length=3, max_length=40
|
||||
required=False, min_length=3, max_length=40,
|
||||
initial='initial value'
|
||||
)
|
||||
list_field = serializers.ListField(
|
||||
child=serializers.ListField(
|
||||
|
@ -128,7 +129,8 @@ class TestMetadata:
|
|||
'read_only': False,
|
||||
'label': 'Char field',
|
||||
'min_length': 3,
|
||||
'max_length': 40
|
||||
'max_length': 40,
|
||||
'initial': 'initial value'
|
||||
},
|
||||
'list_field': {
|
||||
'type': 'list',
|
||||
|
|
Loading…
Reference in New Issue
Block a user