mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-27 12:04:02 +03:00
Fix deprecation warnings in relations_nested tests
This commit is contained in:
parent
e550740b3d
commit
14482a9661
|
@ -46,7 +46,7 @@ class ReverseNestedOneToOneTests(TestCase):
|
||||||
|
|
||||||
def test_one_to_one_retrieve(self):
|
def test_one_to_one_retrieve(self):
|
||||||
queryset = OneToOneTarget.objects.all()
|
queryset = OneToOneTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1', 'source': {'id': 1, 'name': 'source-1'}},
|
{'id': 1, 'name': 'target-1', 'source': {'id': 1, 'name': 'source-1'}},
|
||||||
{'id': 2, 'name': 'target-2', 'source': {'id': 2, 'name': 'source-2'}},
|
{'id': 2, 'name': 'target-2', 'source': {'id': 2, 'name': 'source-2'}},
|
||||||
|
@ -65,7 +65,7 @@ class ReverseNestedOneToOneTests(TestCase):
|
||||||
# Ensure (target 4, target_source 4, source 4) are added, and
|
# Ensure (target 4, target_source 4, source 4) are added, and
|
||||||
# everything else is as expected.
|
# everything else is as expected.
|
||||||
queryset = OneToOneTarget.objects.all()
|
queryset = OneToOneTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1', 'source': {'id': 1, 'name': 'source-1'}},
|
{'id': 1, 'name': 'target-1', 'source': {'id': 1, 'name': 'source-1'}},
|
||||||
{'id': 2, 'name': 'target-2', 'source': {'id': 2, 'name': 'source-2'}},
|
{'id': 2, 'name': 'target-2', 'source': {'id': 2, 'name': 'source-2'}},
|
||||||
|
@ -92,7 +92,7 @@ class ReverseNestedOneToOneTests(TestCase):
|
||||||
# Ensure (target 3, target_source 3, source 3) are updated,
|
# Ensure (target 3, target_source 3, source 3) are updated,
|
||||||
# and everything else is as expected.
|
# and everything else is as expected.
|
||||||
queryset = OneToOneTarget.objects.all()
|
queryset = OneToOneTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1', 'source': {'id': 1, 'name': 'source-1'}},
|
{'id': 1, 'name': 'target-1', 'source': {'id': 1, 'name': 'source-1'}},
|
||||||
{'id': 2, 'name': 'target-2', 'source': {'id': 2, 'name': 'source-2'}},
|
{'id': 2, 'name': 'target-2', 'source': {'id': 2, 'name': 'source-2'}},
|
||||||
|
@ -125,7 +125,7 @@ class ForwardNestedOneToOneTests(TestCase):
|
||||||
|
|
||||||
def test_one_to_one_retrieve(self):
|
def test_one_to_one_retrieve(self):
|
||||||
queryset = OneToOneSource.objects.all()
|
queryset = OneToOneSource.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
|
{'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
|
||||||
{'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
|
{'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
|
||||||
|
@ -144,7 +144,7 @@ class ForwardNestedOneToOneTests(TestCase):
|
||||||
# Ensure (target 4, target_source 4, source 4) are added, and
|
# Ensure (target 4, target_source 4, source 4) are added, and
|
||||||
# everything else is as expected.
|
# everything else is as expected.
|
||||||
queryset = OneToOneSource.objects.all()
|
queryset = OneToOneSource.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
|
{'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
|
||||||
{'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
|
{'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
|
||||||
|
@ -171,7 +171,7 @@ class ForwardNestedOneToOneTests(TestCase):
|
||||||
# Ensure (target 3, target_source 3, source 3) are updated,
|
# Ensure (target 3, target_source 3, source 3) are updated,
|
||||||
# and everything else is as expected.
|
# and everything else is as expected.
|
||||||
queryset = OneToOneSource.objects.all()
|
queryset = OneToOneSource.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
|
{'id': 1, 'name': 'source-1', 'target': {'id': 1, 'name': 'target-1'}},
|
||||||
{'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
|
{'id': 2, 'name': 'source-2', 'target': {'id': 2, 'name': 'target-2'}},
|
||||||
|
@ -224,7 +224,7 @@ class ReverseNestedOneToManyTests(TestCase):
|
||||||
|
|
||||||
def test_one_to_many_retrieve(self):
|
def test_one_to_many_retrieve(self):
|
||||||
queryset = OneToManyTarget.objects.all()
|
queryset = OneToManyTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1', 'sources': [{'id': 1, 'name': 'source-1'},
|
{'id': 1, 'name': 'target-1', 'sources': [{'id': 1, 'name': 'source-1'},
|
||||||
{'id': 2, 'name': 'source-2'},
|
{'id': 2, 'name': 'source-2'},
|
||||||
|
@ -247,7 +247,7 @@ class ReverseNestedOneToManyTests(TestCase):
|
||||||
# Ensure source 4 is added, and everything else is as
|
# Ensure source 4 is added, and everything else is as
|
||||||
# expected.
|
# expected.
|
||||||
queryset = OneToManyTarget.objects.all()
|
queryset = OneToManyTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1', 'sources': [{'id': 1, 'name': 'source-1'},
|
{'id': 1, 'name': 'target-1', 'sources': [{'id': 1, 'name': 'source-1'},
|
||||||
{'id': 2, 'name': 'source-2'},
|
{'id': 2, 'name': 'source-2'},
|
||||||
|
@ -279,7 +279,7 @@ class ReverseNestedOneToManyTests(TestCase):
|
||||||
# Ensure (target 1, source 1) are updated,
|
# Ensure (target 1, source 1) are updated,
|
||||||
# and everything else is as expected.
|
# and everything else is as expected.
|
||||||
queryset = OneToManyTarget.objects.all()
|
queryset = OneToManyTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1-updated', 'sources': [{'id': 1, 'name': 'source-1-updated'},
|
{'id': 1, 'name': 'target-1-updated', 'sources': [{'id': 1, 'name': 'source-1-updated'},
|
||||||
{'id': 2, 'name': 'source-2'},
|
{'id': 2, 'name': 'source-2'},
|
||||||
|
@ -299,7 +299,7 @@ class ReverseNestedOneToManyTests(TestCase):
|
||||||
# Ensure source 2 is deleted, and everything else is as
|
# Ensure source 2 is deleted, and everything else is as
|
||||||
# expected.
|
# expected.
|
||||||
queryset = OneToManyTarget.objects.all()
|
queryset = OneToManyTarget.objects.all()
|
||||||
serializer = self.Serializer(queryset)
|
serializer = self.Serializer(queryset, many=True)
|
||||||
expected = [
|
expected = [
|
||||||
{'id': 1, 'name': 'target-1', 'sources': [{'id': 1, 'name': 'source-1'},
|
{'id': 1, 'name': 'target-1', 'sources': [{'id': 1, 'name': 'source-1'},
|
||||||
{'id': 3, 'name': 'source-3'}]}
|
{'id': 3, 'name': 'source-3'}]}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user