I have both model and social backends configured in settings.py:
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'social_core.backends.mediawiki.MediaWiki',
)
When I run this test:
from django.test import TestCase, Client
from django.contrib.auth.models import User
class UserActivitiesViewTest(TestCase):
def test_mainspace_title_contains_colon(self):
user_fred = User.objects.create_user('Fred', 'fr...@example.com', 'password')
client = Client()
client.force_login(user_fred, backend='django.contrib.auth.backends.ModelBackend')
response = client.get('/spi/spi-user-activities/Foo', {'count': 10, 'main': 1}, follow=True)
The view that's being tested is:
class UserActivitiesView(LoginRequiredMixin, View):
def get(self, request, user_name):
.....
I get a social_django.models.UserSocialAuth.DoesNotExist exception in the client.get() call. Why is it doing any kind of query on UserSocialAuth if I'm telling force_login() to use ModelBackend?
I'm running django 2.2, python 3.7