Failing test to show problem of #720

This commit is contained in:
Bouke Haarsma 2013-03-10 21:01:51 +01:00
parent 239758e034
commit 3cd3235881

View File

@ -407,14 +407,14 @@ class PKNullableOneToOneTests(TestCase):
target.save() target.save()
new_target = OneToOneTarget(name='target-2') new_target = OneToOneTarget(name='target-2')
new_target.save() new_target.save()
source = NullableOneToOneSource(name='source-1', target=target) source = NullableOneToOneSource(name='source-1', target=new_target)
source.save() source.save()
def test_reverse_foreign_key_retrieve_with_null(self): def test_reverse_foreign_key_retrieve_with_null(self):
queryset = OneToOneTarget.objects.all() queryset = OneToOneTarget.objects.all()
serializer = NullableOneToOneTargetSerializer(queryset, many=True) serializer = NullableOneToOneTargetSerializer(queryset, many=True)
expected = [ expected = [
{'id': 1, 'name': 'target-1', 'nullable_source': 1}, {'id': 1, 'name': 'target-1', 'nullable_source': None},
{'id': 2, 'name': 'target-2', 'nullable_source': None}, {'id': 2, 'name': 'target-2', 'nullable_source': 1},
] ]
self.assertEqual(serializer.data, expected) self.assertEqual(serializer.data, expected)