Hi Valery,

You probably don't need to reproduce everything that is labeled
@skipIfCustomUser - those tests are the "core" tests to make sure the basic
auth mechanisms work as expected. The remaining tests are the ones that
exist to make sure that a couple of key patterns in custom Users work as
expected. If you're writing a test suite for your own user model, you don't
need to re-validated that the core logic works as expected - you just need
to validate that your extensions play well with the core.

Yours,
Russ Magee %-)

On Sat, Oct 11, 2014 at 4:13 PM, Valery Melou <valeryme...@gmail.com> wrote:

> Thanks for your answer Russell.
> I've been browsing the django.contrib.auth.test module and I was wondering
> if I should just rewrite all tests marked @sikpIfCustomUser. If so, there
> is a lot of work to do. Anyway I will start by checking those marked
> @override_settings(AUTH_USER_MODEL='auth.ExtensionUser') as you suggested.
> Thanks again.
>
> Le samedi 11 octobre 2014 00:49:51 UTC+1, Russell Keith-Magee a écrit :
>>
>> Hi Valery,
>>
>> We don't currently ship an integration test to validate your custom User
>> model, for two reasons:
>>
>>  1) The requirements for a User model depends on what features you're
>> using - the core requirements are listed in the docs, but depending on
>> exactly what you're doing with the User model, there might be other
>> integration requirements.
>>
>>  2) We haven't got a good way to distribute a test suite for a model that
>> we haven't defined.
>>
>> That said, the baked in test suite in django.contrib.auth does test a
>> number of tests to ensure that custom User models work; if you're looking
>> for a starting point, that suite might be a good starting point. Any test
>> that isn't marked @skipIfCustomUser needs to pass regardless of the user
>> model. Tests labelled 
>> @override_settings(AUTH_USER_MODEL='auth.ExtensionUser')
>> are tests for specific user models, which will give you an idea of the sort
>> of tests you might need to add for your own model.
>>
>> I hope that helps. If, as a result of doing this, you end up with a
>> template for a good set of integration tests for a custom model, this would
>> be a good contribution back to the community - a "template" project for a
>> custom User model app that others can fork and modify as required would be
>> one way for Django to distribute an integration test suite.
>>
>> Yours,
>> Russ Magee %-)
>>
>> On Fri, Oct 10, 2014 at 4:24 PM, Valery Melou <valer...@gmail.com> wrote:
>>
>>> Hi everybody.
>>> I'm creating a custom auth user model to remove 'first_name' and
>>> 'last_name' attributes from the default one and to make the 'email' field
>>> required and unique. I would like to know which tests I'm supposed to write
>>> to make sure that my model support each feature of the default one.
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/91e947b3-b3d4-4cdc-b7d0-b3426eeea668%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/91e947b3-b3d4-4cdc-b7d0-b3426eeea668%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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+unsubscr...@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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f0eccad9-6d6f-4b8c-ada5-ae744c0f6692%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f0eccad9-6d6f-4b8c-ada5-ae744c0f6692%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq849vSqTwEhBphPgZed_7vzg2%3D%3DS%2B9BfYWdaWR9F_b9%2BdWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to