mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Update docstrings
This commit is contained in:
parent
79f635e0dd
commit
da6b9576c5
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
General tests for relational fields.
|
||||
General serializer field tests.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
@ -29,15 +29,21 @@ class CharPrimaryKeyModelSerializer(serializers.ModelSerializer):
|
|||
class ReadOnlyFieldTests(TestCase):
|
||||
def test_auto_now_fields_read_only(self):
|
||||
"""
|
||||
auto_now and auto_now_add fields should be readonly by default.
|
||||
auto_now and auto_now_add fields should be read_only by default.
|
||||
"""
|
||||
serializer = TimestampedModelSerializer()
|
||||
self.assertEquals(serializer.fields['added'].read_only, True)
|
||||
|
||||
def test_auto_pk_fields_read_only(self):
|
||||
"""
|
||||
AutoField fields should be read_only by default.
|
||||
"""
|
||||
serializer = TimestampedModelSerializer()
|
||||
self.assertEquals(serializer.fields['id'].read_only, True)
|
||||
|
||||
def test_non_auto_pk_fields_not_read_only(self):
|
||||
"""
|
||||
PK fields other than AutoField fields should not be read_only by default.
|
||||
"""
|
||||
serializer = CharPrimaryKeyModelSerializer()
|
||||
self.assertEquals(serializer.fields['id'].read_only, False)
|
||||
|
|
Loading…
Reference in New Issue
Block a user