diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-10-20 23:22:46 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-10-20 23:22:46 +0200 |
| commit | d7c6a57d606bbb8185f9215ffce4c0516a9ae438 (patch) | |
| tree | b8d7898b8623ae5567e3c69e7463b3fce00bfbe3 /tests/regressiontests/multiple_database/tests.py | |
| parent | 2f722d9728c1946d5d800b3e0b24de7f566a755d (diff) | |
Used @override_settings in several tests.
Diffstat (limited to 'tests/regressiontests/multiple_database/tests.py')
| -rw-r--r-- | tests/regressiontests/multiple_database/tests.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/regressiontests/multiple_database/tests.py b/tests/regressiontests/multiple_database/tests.py index e6d224e302..79fe6beebd 100644 --- a/tests/regressiontests/multiple_database/tests.py +++ b/tests/regressiontests/multiple_database/tests.py @@ -4,13 +4,13 @@ import datetime import pickle from operator import attrgetter -from django.conf import settings from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.core import management from django.db import connections, router, DEFAULT_DB_ALIAS from django.db.models import signals from django.test import TestCase +from django.test.utils import override_settings from django.utils.six import StringIO from .models import Book, Person, Pet, Review, UserProfile @@ -1620,20 +1620,11 @@ class AuthTestCase(TestCase): command_output = new_io.getvalue().strip() self.assertTrue('"email": "alice@example.com",' in command_output) -_missing = object() -class UserProfileTestCase(TestCase): - def setUp(self): - self.old_auth_profile_module = getattr(settings, 'AUTH_PROFILE_MODULE', _missing) - settings.AUTH_PROFILE_MODULE = 'multiple_database.UserProfile' - def tearDown(self): - if self.old_auth_profile_module is _missing: - del settings.AUTH_PROFILE_MODULE - else: - settings.AUTH_PROFILE_MODULE = self.old_auth_profile_module +@override_settings(AUTH_PROFILE_MODULE='multiple_database.UserProfile') +class UserProfileTestCase(TestCase): def test_user_profiles(self): - alice = User.objects.create_user('alice', 'alice@example.com') bob = User.objects.db_manager('other').create_user('bob', 'bob@example.com') |
