mercredi 24 octobre 2018

AnonymousUser with django.test.client.login()

I'm testing login function.

cls.pwd = '12345'
# UserFactory is a package 'factory'to fill in with random data 
cls.user_1 = UserFactory(password=cls.pwd)
cls.selenium = WebDriver()
cls.client = Client()
cls.client.login(username=cls.user_1.username, password=cls.pwd)

So I can pass the login page, but then, when I do request.user to check the data for this user, it's an AnonymousUser

Aucun commentaire:

Enregistrer un commentaire