[Django]-Test not passing in Django when it should

4👍

You have to reload test_user from the database since changing of the user is performed to another user instance. That means if:

u1 = User.objects.get(id = 1)
u2 = User.objects.get(id = 1)

changes to u1 (even if saved) are not mirrored to u2. So you have to get again the user from the db after the request.

Leave a comment