#9887: Testclient user have not enough permissions to create another users.
---------------------------------------------+------------------------------
Reporter: nuald <[email protected]> | Owner: nobody
Status: new | Milestone:
Component: Testing framework | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 1 |
---------------------------------------------+------------------------------
During Django unit-testing the testclient user is creating another users,
and if someone (like we are) added security checks like one below, tests
will fail.
Sample code:
{{{
def check_change_permissions(sender, instance, **kwargs):
user = get_current_user()
# WARNING! This is used for passing Django unit-testing.
if not user:
return
#WARNING! For successful login.
if user.is_anonymous():
return
if user.is_superuser:
return
if user != instance:
raise PermissionDenied
pre_save.connect(check_change_permissions, sender = User)
}}}
The fix is trivial - add superuser permissions to the testclient user.
Patch is included.
--
Ticket URL: <http://code.djangoproject.com/ticket/9887>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---