Ticket #16055: 16055_tests.diff

File 16055_tests.diff, 2.2 KB (added by Ramiro Morales, 13 years ago)

Minimal patch for current existing tests

  • tests/regressiontests/generic_relations_regress/models.py

    diff -r 23ee026c45ef tests/regressiontests/generic_relations_regress/models.py
    a b  
    22from django.contrib.contenttypes import generic
    33from django.contrib.contenttypes.models import ContentType
    44
    5 __all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address', 
    6            'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2', 
     5__all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
     6           'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2',
    77           'Contact', 'Organization', 'Note')
    88
    99class Link(models.Model):
     
    4646        return self.name
    4747
    4848class CharLink(models.Model):
     49    title = models.CharField(max_length=20)
    4950    content_type = models.ForeignKey(ContentType)
    5051    object_id = models.CharField(max_length=100)
    5152    content_object = generic.GenericForeignKey()
    5253
    5354class TextLink(models.Model):
     55    title = models.CharField(max_length=20)
    5456    content_type = models.ForeignKey(ContentType)
    5557    object_id = models.TextField()
    5658    content_object = generic.GenericForeignKey()
  • tests/regressiontests/generic_relations_regress/tests.py

    diff -r 23ee026c45ef tests/regressiontests/generic_relations_regress/tests.py
    a b  
    4242        tl = TextLink.objects.create(content_object=oddrel)
    4343        oddrel.delete()
    4444
     45    def test_charlink_filter(self):
     46        # Regression for #16055
     47        oddrel = OddRelation1.objects.create(name='clink')
     48        cl = CharLink.objects.create(content_object=oddrel, title='title')
     49        OddRelation1.objects.filter(clinks__title='title')
     50
     51    def test_textlink_filter(self):
     52        # Regression for #16055
     53        oddrel = OddRelation2.objects.create(name='tlink')
     54        tl = TextLink.objects.create(content_object=oddrel, title='title')
     55        OddRelation2.objects.filter(tlinks__title='title')
     56
    4557    def test_q_object_or(self):
    4658        """
    4759        Tests that SQL query parameters for generic relations are properly
Back to Top