Ticket #24951: 24951-test.diff

File 24951-test.diff, 1.2 KB (added by Tim Graham, 9 years ago)
  • tests/one_to_one/models.py

    diff --git a/tests/one_to_one/models.py b/tests/one_to_one/models.py
    index 8a5defe..a71e65a 100644
    a b class MultiModel(models.Model):  
    8383
    8484
    8585class Target(models.Model):
    86     pass
     86    name = models.CharField(max_length=50)
    8787
    8888
    8989class Pointer(models.Model):
  • tests/one_to_one/tests.py

    diff --git a/tests/one_to_one/tests.py b/tests/one_to_one/tests.py
    index 6604299..62cd1d5 100644
    a b from django.test import TestCase  
    55
    66from .models import (
    77    Bar, Director, Favorites, HiddenPointer, ManualPrimaryKey, MultiModel,
    8     Place, RelatedModel, Restaurant, School, Target, UndergroundBar, Waiter,
     8    Place, Pointer, RelatedModel, Restaurant, School, Target, UndergroundBar,
     9    Waiter,
    910)
    1011
    1112
    class OneToOneTests(TestCase):  
    283284            []
    284285        )
    285286
     287    def test_o2o_primary_key_delete(self):
     288        t = Target.objects.create(name='name')
     289        Pointer.objects.create(other=t)
     290        num_deleted, _ = Pointer.objects.filter(other__name='name').delete()
     291        self.assertEqual(num_deleted, 1)
     292
    286293    def test_reverse_object_does_not_exist_cache(self):
    287294        """
    288295        Regression for #13839 and #17439.
Back to Top