Ticket #15179: requestfactory_for_login.diff

File requestfactory_for_login.diff, 602 bytes (added by Ciantic, 5 years ago)

Client.login to use RequestFactory

  • django/test/client.py

    diff --git a/django/test/client.py b/django/test/client.py
    index 24fe627..068f566 100644
    a b class Client(RequestFactory): 
    504504            engine = import_module(settings.SESSION_ENGINE)
    505505
    506506            # Create a fake request to store login details.
    507             request = HttpRequest()
     507            # Notice that we cannot use super get since it returns response
     508            request = RequestFactory(**self.defaults).post("/login/")
    508509            if self.session:
    509510                request.session = self.session
    510511            else:
Back to Top