Patch client test fixture with useful login method.
This removes django-testclient-extensions because it doesn't compatible with django 1.7.remotes/origin/enhancement/email-actions
parent
c1b011fa99
commit
59c7478075
|
@ -41,15 +41,13 @@ class PartialMethodCaller:
|
|||
@pytest.fixture
|
||||
def client():
|
||||
from django.test.client import Client
|
||||
from django.test.client import MULTIPART_CONTENT
|
||||
|
||||
class _Client(Client):
|
||||
def login(self, user=None, backend="django.contrib.auth.backends.ModelBackend", **credentials):
|
||||
if user is None:
|
||||
return super().login(**credentials)
|
||||
|
||||
# This will be changed on django1.7 branch with other location
|
||||
with mock.patch('django.test.client.authenticate') as authenticate:
|
||||
with mock.patch('django.contrib.auth.authenticate') as authenticate:
|
||||
user.backend = backend
|
||||
authenticate.return_value = user
|
||||
return super().login(**credentials)
|
||||
|
|
Loading…
Reference in New Issue