Skip to content

Test client doesn't attach user attribute to request #62

Closed
@danielquinn

Description

@danielquinn

I'm trying out the test client and my tests are exploding because I have signal handlers that listing for user_logged_in() and attempt to access request.user. A brief stroll through the Django code for login() tells me that it won't attach user to the request unless the attribute is already set.

Given that the test client creates the request without attaching a .user attribute, this will never work as it is. Could this be fixed by simply adding request.user = None right after this line?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions