summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-11-11 23:55:08 -0500
committerSimon Charette <charette.s@gmail.com>2015-11-14 12:08:34 -0500
commitfb016e6c55b34c9d39e7456e7005422a5af48e0a (patch)
treec093e082cd9a9de10794d25836baab4efaa8360e /tests
parente8512811cd56d1be9280a81c6041654779f3eefd (diff)
[1.9.x] Refs #25745 -- Isolated a foreign_object test.
Backport of 2eefbca1a4140d8a8174a06a1f0160fcc76d8f64 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/foreign_object/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py
index 90d7b34721..5291275b25 100644
--- a/tests/foreign_object/tests.py
+++ b/tests/foreign_object/tests.py
@@ -1,6 +1,7 @@
import datetime
from operator import attrgetter
+from django.apps.registry import Apps
from django.core.exceptions import FieldError
from django.db import models
from django.db.models.fields.related import ForeignObject
@@ -398,11 +399,14 @@ class MultiColumnFKTests(TestCase):
class TestModelCheckTests(SimpleTestCase):
def test_check_composite_foreign_object(self):
+ test_apps = Apps(['foreign_object'])
+
class Parent(models.Model):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
class Meta:
+ apps = test_apps
unique_together = (('a', 'b'),)
class Child(models.Model):
@@ -417,15 +421,21 @@ class TestModelCheckTests(SimpleTestCase):
related_name='children',
)
+ class Meta:
+ apps = test_apps
+
self.assertEqual(Child._meta.get_field('parent').check(from_model=Child), [])
def test_check_subset_composite_foreign_object(self):
+ test_apps = Apps(['foreign_object'])
+
class Parent(models.Model):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
c = models.PositiveIntegerField()
class Meta:
+ apps = test_apps
unique_together = (('a', 'b'),)
class Child(models.Model):
@@ -441,4 +451,7 @@ class TestModelCheckTests(SimpleTestCase):
related_name='children',
)
+ class Meta:
+ apps = test_apps
+
self.assertEqual(Child._meta.get_field('parent').check(from_model=Child), [])