Code

Ticket #6818: 6818-failing-tests-against-8818.diff

File 6818-failing-tests-against-8818.diff, 1.9 KB (added by Honza_Kral, 6 years ago)

tests that fail for the current SVN version

Line 
1commit cc3381358bac66f15cc915dc926b535ee32c3240
2Author: Honza Král <Honza.Kral@gmail.com>
3Date:   Tue Sep 2 00:09:05 2008 +0200
4
5    Added failing tests for generic relation delete()
6
7diff --git a/tests/modeltests/generic_relations/models.py b/tests/modeltests/generic_relations/models.py
8index 2f36e26..5a73ab4 100644
9--- a/tests/modeltests/generic_relations/models.py
10+++ b/tests/modeltests/generic_relations/models.py
11@@ -45,6 +45,11 @@ class Comparison(models.Model):
12     def __unicode__(self):
13         return u"%s is %s than %s" % (self.first_obj, self.comparative, self.other_obj)
14 
15+class SomeModel(models.Model):
16+    tag = models.ForeignKey(TaggedItem)
17+    def __unicode__(self):
18+        return unicode(self.tag)
19+
20 class Animal(models.Model):
21     common_name = models.CharField(max_length=150)
22     latin_name = models.CharField(max_length=150)
23@@ -144,9 +149,17 @@ __test__ = {'API_TESTS':"""
24 >>> [(t.tag, t.content_type, t.object_id) for t in TaggedItem.objects.all()]
25 [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'hairy', <ContentType: animal>, 2), (u'salty', <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1), (u'yellow', <ContentType: animal>, 2)]
26 
27+>>> ctype = ContentType.objects.get_for_model(lion)
28+>>> ti = TaggedItem.objects.get(content_type__id=ctype.pk, object_id=lion.pk, tag='hairy')
29+>>> sm = SomeModel( tag=ti )
30+>>> sm.save()
31+>>> sm.tag
32+<TaggedItem: hairy>
33 >>> lion.delete()
34 >>> [(t.tag, t.content_type, t.object_id) for t in TaggedItem.objects.all()]
35 [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'salty', <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1)]
36+>>> SomeModel.objects.all()
37+[]
38 
39 # If Generic Relation is not explicitly defined, any related objects
40 # remain after deletion of the source object.