Sunday, September 29, 2013

Re: Testing: @override_settings(AUTH_USER_MODEL='auth.User') no working.


On Mon, Sep 30, 2013 at 7:27 AM, Serge G. Spaolonzi <serge@cobalys.com> wrote:
Hi,

I am failing to override the AUTH_USER_MODEL settings for a unittest, it throws:

"Manager isn't available; User has been swapped for 'None'"

Is it possible to override AUTH_USER_MODEL in the unittest?
My goal is to use the default user model provided by django for the test only.
 
Yes, it is possible. That's why the approach is documented:


If you're getting an error, It sounds like something else is going wrong in your test suite -- my guess would be that you haven't got the auth app in INSTALLED_APPS. However, it's impossible to say for sure without seeing more code.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment