2👍
✅
That is what helped me with authentication
from django.contrib.auth import get_user_model
class TestParent(TestCase):
def setUp(self):
username = 'testuser'
password = 'testpass'
User = get_user_model()
user = User.objects.create_user(username, password=password)
logged_in = self.client.login(username=username, password=password)
self.assertTrue(logged_in)
Source:stackexchange.com