summaryrefslogtreecommitdiff
path: root/tests/generic_relations_regress
diff options
context:
space:
mode:
authorsarahboyce <sarahvboyce95@gmail.com>2022-04-19 13:21:23 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-04-21 10:12:28 +0200
commitcd4da34fc1f1df08f593e461b2f670bfd61d0d2f (patch)
tree315cd3eba3bfee07fca59a1cff6405ac6923a379 /tests/generic_relations_regress
parent1ed8ca43f61138b8f8d6f92106c27060753ed4e7 (diff)
Fixed #33004 -- Made saving objects with unsaved GenericForeignKey raise ValueError.
This aligns to the behaviour of OneToOneField and ForeignKey fields. Thanks Jonny Park for the initial patch.
Diffstat (limited to 'tests/generic_relations_regress')
-rw-r--r--tests/generic_relations_regress/models.py5
-rw-r--r--tests/generic_relations_regress/tests.py10
2 files changed, 0 insertions, 15 deletions
diff --git a/tests/generic_relations_regress/models.py b/tests/generic_relations_regress/models.py
index a028ff01d8..dc55b2a83b 100644
--- a/tests/generic_relations_regress/models.py
+++ b/tests/generic_relations_regress/models.py
@@ -104,11 +104,6 @@ class Company(models.Model):
links = GenericRelation(Link)
-# For testing #13085 fix, we also use Note model defined above
-class Developer(models.Model):
- name = models.CharField(max_length=15)
-
-
class Team(models.Model):
name = models.CharField(max_length=15)
diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py
index 16705131a7..6c708fefbb 100644
--- a/tests/generic_relations_regress/tests.py
+++ b/tests/generic_relations_regress/tests.py
@@ -1,4 +1,3 @@
-from django.db import IntegrityError
from django.db.models import ProtectedError, Q, Sum
from django.forms.models import modelform_factory
from django.test import TestCase, skipIfDBFeature
@@ -15,7 +14,6 @@ from .models import (
Contact,
Content,
D,
- Developer,
Guild,
HasLinkThing,
Link,
@@ -140,14 +138,6 @@ class GenericRelationTests(TestCase):
self.assertEqual(count_places(p1), 1)
self.assertEqual(count_places(p2), 1)
- def test_target_model_is_unsaved(self):
- """Test related to #13085"""
- # Fails with another, ORM-level error
- dev1 = Developer(name="Joe")
- note = Note(note="Deserves promotion", content_object=dev1)
- with self.assertRaises(IntegrityError):
- note.save()
-
def test_target_model_len_zero(self):
"""
Saving a model with a GenericForeignKey to a model instance whose