mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Removed some direct settings manipulations in tests; refs #21230.
This commit is contained in:
committed by
Tim Graham
parent
499cd912ca
commit
3565efaa45
@@ -18,7 +18,7 @@ from django.conf import settings
|
||||
from django.core import management, serializers
|
||||
from django.db import transaction, connection
|
||||
from django.test import TestCase, TransactionTestCase
|
||||
from django.test.utils import Approximate
|
||||
from django.test.utils import Approximate, override_settings
|
||||
from django.utils import six
|
||||
from django.utils.six import StringIO
|
||||
|
||||
@@ -26,22 +26,18 @@ from .models import (Category, Author, Article, AuthorProfile, Actor, Movie,
|
||||
Score, Player, Team)
|
||||
|
||||
|
||||
class SerializerRegistrationTests(unittest.TestCase):
|
||||
@override_settings(
|
||||
SERIALIZATION_MODULES = {
|
||||
"json2" : "django.core.serializers.json",
|
||||
}
|
||||
)
|
||||
class SerializerRegistrationTests(TestCase):
|
||||
def setUp(self):
|
||||
self.old_SERIALIZATION_MODULES = getattr(settings, 'SERIALIZATION_MODULES', None)
|
||||
self.old_serializers = serializers._serializers
|
||||
|
||||
serializers._serializers = {}
|
||||
settings.SERIALIZATION_MODULES = {
|
||||
"json2" : "django.core.serializers.json",
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
serializers._serializers = self.old_serializers
|
||||
if self.old_SERIALIZATION_MODULES:
|
||||
settings.SERIALIZATION_MODULES = self.old_SERIALIZATION_MODULES
|
||||
else:
|
||||
delattr(settings, 'SERIALIZATION_MODULES')
|
||||
|
||||
def test_register(self):
|
||||
"Registering a new serializer populates the full registry. Refs #14823"
|
||||
|
||||
Reference in New Issue
Block a user