Hi Sven,
You can mock the call to the external service like this.
@mock.patch.object(MyModelBackend, 'authenticate') # First the
class of your model backend. Then the method you want to mock.
def test_something_that_uses_login(self, mock_authenticate): # The
mock object is passed to your
In my model backend I usually call an external service which returns me an
user that is saved and returned. When I don't have credentials I want to
mock the backend for some test cases. In the setup of each test case I am
calling the login method where CRED contains the real credentials or mock
2 matches
Mail list logo