mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
stop InvalidStreamModel from polluting the overall model registry
This commit is contained in:
parent
0143787fab
commit
f35536ccee
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
from django.apps import apps
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
@ -74,6 +75,17 @@ class TestLazyStreamField(TestCase):
|
|||||||
with self.assertNumQueries(0):
|
with self.assertNumQueries(0):
|
||||||
instances_lookup[self.no_image.pk].body[0]
|
instances_lookup[self.no_image.pk].body[0]
|
||||||
|
|
||||||
|
class TestSystemCheck(TestCase):
|
||||||
|
def tearDown(self):
|
||||||
|
# unregister InvalidStreamModel from the overall model registry
|
||||||
|
# so that it doesn't break tests elsewhere
|
||||||
|
for package in ('wagtailcore', 'wagtail.wagtailcore.tests'):
|
||||||
|
try:
|
||||||
|
del apps.all_models[package]['invalidstreammodel']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
apps.clear_cache()
|
||||||
|
|
||||||
def test_system_check_validates_block(self):
|
def test_system_check_validates_block(self):
|
||||||
class InvalidStreamModel(models.Model):
|
class InvalidStreamModel(models.Model):
|
||||||
body = StreamField([
|
body = StreamField([
|
||||||
|
Loading…
Reference in New Issue
Block a user