mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
Fixed misspelled remarks.
This commit is contained in:
parent
f245398187
commit
12b3adcfec
|
@ -20,7 +20,8 @@ class BlogPostCommentSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class PhotoSerializer(serializers.Serializer):
|
class PhotoSerializer(serializers.Serializer):
|
||||||
description = serializers.CharField()
|
description = serializers.CharField()
|
||||||
album_url = serializers.HyperlinkedRelatedField(source='album', view_name='album-detail', queryset=Album.objects.all(), slug_field='title', slug_url_kwarg='title')
|
album_url = serializers.HyperlinkedRelatedField(source='album', view_name='album-detail',
|
||||||
|
queryset=Album.objects.all(), slug_field='title', slug_url_kwarg='title')
|
||||||
|
|
||||||
def restore_object(self, attrs, instance=None):
|
def restore_object(self, attrs, instance=None):
|
||||||
return Photo(**attrs)
|
return Photo(**attrs)
|
||||||
|
@ -99,7 +100,7 @@ class TestBasicHyperlinkedView(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Create 3 BasicModel intances.
|
Create 3 BasicModel instances.
|
||||||
"""
|
"""
|
||||||
items = ['foo', 'bar', 'baz']
|
items = ['foo', 'bar', 'baz']
|
||||||
for item in items:
|
for item in items:
|
||||||
|
@ -136,7 +137,7 @@ class TestManyToManyHyperlinkedView(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Create 3 BasicModel intances.
|
Create 3 BasicModel instances.
|
||||||
"""
|
"""
|
||||||
items = ['foo', 'bar', 'baz']
|
items = ['foo', 'bar', 'baz']
|
||||||
anchors = []
|
anchors = []
|
||||||
|
@ -190,7 +191,6 @@ class TestCreateWithForeignKeys(TestCase):
|
||||||
self.create_view = BlogPostCommentListCreate.as_view()
|
self.create_view = BlogPostCommentListCreate.as_view()
|
||||||
|
|
||||||
def test_create_comment(self):
|
def test_create_comment(self):
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'text': 'A test comment',
|
'text': 'A test comment',
|
||||||
'blog_post_url': 'http://testserver/posts/1/'
|
'blog_post_url': 'http://testserver/posts/1/'
|
||||||
|
@ -215,7 +215,6 @@ class TestCreateWithForeignKeysAndCustomSlug(TestCase):
|
||||||
self.list_create_view = PhotoListCreate.as_view()
|
self.list_create_view = PhotoListCreate.as_view()
|
||||||
|
|
||||||
def test_create_photo(self):
|
def test_create_photo(self):
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'description': 'A test photo',
|
'description': 'A test photo',
|
||||||
'album_url': 'http://testserver/albums/test-album/'
|
'album_url': 'http://testserver/albums/test-album/'
|
||||||
|
@ -224,7 +223,8 @@ class TestCreateWithForeignKeysAndCustomSlug(TestCase):
|
||||||
request = factory.post('/photos/', data=data)
|
request = factory.post('/photos/', data=data)
|
||||||
response = self.list_create_view(request)
|
response = self.list_create_view(request)
|
||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
self.assertNotIn('Location', response, msg='Location should only be included if there is a "url" field on the serializer')
|
self.assertNotIn('Location', response,
|
||||||
|
msg='Location should only be included if there is a "url" field on the serializer')
|
||||||
self.assertEqual(self.post.photo_set.count(), 1)
|
self.assertEqual(self.post.photo_set.count(), 1)
|
||||||
self.assertEqual(self.post.photo_set.all()[0].description, 'A test photo')
|
self.assertEqual(self.post.photo_set.all()[0].description, 'A test photo')
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class TestOptionalRelationHyperlinkedView(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Create 1 OptionalRelationModel intances.
|
Create 1 OptionalRelationModel instances.
|
||||||
"""
|
"""
|
||||||
OptionalRelationModel().save()
|
OptionalRelationModel().save()
|
||||||
self.objects = OptionalRelationModel.objects
|
self.objects = OptionalRelationModel.objects
|
||||||
|
|
Loading…
Reference in New Issue
Block a user