﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20073	Provide API for creating User objects in tests	jacek.tomek@…	nobody	"Sometimes you want to create a user object for tests (e.g. create User, login, add some object and test if user info was stored within object; whatever).

Prior 1.5 it was rather easy task:

{{{
User._default_manager.create_user('admin', 'mail', 'admin')
user.is_staff = True  # make him admin
user.save()
}}}

However, since introducing interchangeable User models, it may fail (even when using {{{User = get_user_model()}}} first) because {{{create_user}}} or {{{create_superuser}}} may take different parameters.

I know there is skipIfCustomUser decorator, but what about tests that just need to check something with user?

There should be a mandatory method like {{{create_test_user}} on {{{UserManager}}}. Method should take no arguments and return usable User instance. There could also be {{{create_test_superuser}}}. With those methods unittesting with User colud be possible in almost all cases."	New feature	closed	contrib.auth	1.5	Normal	wontfix	1.5 user tests		Accepted	0	0	0	0	0	0
