Total Complexity | 4 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
27 | class _Client(Client): |
||
28 | def login( |
||
29 | self, user=None, |
||
30 | backend="django.contrib.auth.backends.ModelBackend", |
||
31 | **credentials): |
||
32 | if user is None: |
||
33 | return super(_Client, self).login(**credentials) |
||
34 | |||
35 | with mock.patch('django.contrib.auth.authenticate') as authenticate: |
||
36 | user.backend = backend |
||
37 | authenticate.return_value = user |
||
38 | return super(_Client, self).login(**credentials) |
||
39 | |||
40 | @property |
||
41 | def json(self): |
||
42 | return PartialMethodCaller( |
||
43 | obj=self, content_type='application/json;charset="utf-8"') |
||
44 | |||
58 |