Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed #17966 -- 'AttributeError: AUTH_PROFILE_MODULE' when running tests #36

Closed
wants to merge 1 commit into from

4 participants

@robgolding63

Removed all the code which checks for settings.AUTH_PROFILE_MODULE and replaced with an extra kwarg on the override_settings decorator. Net effect is about 20 fewer lines and the test now passes.

@claudep
Collaborator

Fixed in 5318783

@claudep claudep closed this
@vladimiroff

Am I the only who thinks that this should be released in 1.4.x!?
This issue makes it impossible to use custom AUTH_PROFILE_MODULE in 1.4 after all.

@apollo13
Owner

No, we won't fix it in 1.4, please see our backporting policy: https://docs.djangoproject.com/en/dev/internals/release-process/#supported-versions -- Also it doesn't make it impossible to use the AUTH_PROFILE_MODULE, it just makes it hard to run the tests (for the contrib.auth app).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 1, 2012
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 18 deletions.
  1. +1 −0  AUTHORS
  2. +1 −18 django/contrib/auth/tests/models.py
View
1  AUTHORS
@@ -565,6 +565,7 @@ answer newbie questions, and generally made Django that much better:
Gasper Zejn <zejn@kiberpipa.org>
Jarek Zgoda <jarek.zgoda@gmail.com>
Cheng Zhang
+ Rob Golding <rob@robgolding.com>
A big THANK YOU goes to:
View
19 django/contrib/auth/tests/models.py
@@ -5,29 +5,12 @@
SiteProfileNotAvailable, UserManager)
-@override_settings(USE_TZ=False)
+@override_settings(USE_TZ=False, AUTH_PROFILE_MODULE='')
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
- def setUp(self):
- """Backs up the AUTH_PROFILE_MODULE"""
- self.old_AUTH_PROFILE_MODULE = getattr(settings,
- 'AUTH_PROFILE_MODULE', None)
-
- def tearDown(self):
- """Restores the AUTH_PROFILE_MODULE -- if it was not set it is deleted,
- otherwise the old value is restored"""
- if self.old_AUTH_PROFILE_MODULE is None and \
- hasattr(settings, 'AUTH_PROFILE_MODULE'):
- del settings.AUTH_PROFILE_MODULE
-
- if self.old_AUTH_PROFILE_MODULE is not None:
- settings.AUTH_PROFILE_MODULE = self.old_AUTH_PROFILE_MODULE
-
def test_site_profile_not_available(self):
# calling get_profile without AUTH_PROFILE_MODULE set
- if hasattr(settings, 'AUTH_PROFILE_MODULE'):
- del settings.AUTH_PROFILE_MODULE
user = User.objects.get(username='testclient')
self.assertRaises(SiteProfileNotAvailable, user.get_profile)
Something went wrong with that request. Please try again.