Im trying to unit test one of my views that is decorated with @verified_email_required. I am unable to find out how to set the user as having their email verified so that it will allow them to view the page and assert that it uses the correct template (creating a superuser doesnt help).
This is the error im getting
AssertionError: False is not true : Template 'enrolment/index.html' was not a template used to render the response. Actual template(s) used: account/verified_email_required.html, account/base.html, base.html
And this is my test
def test_verified_user_uses_correct_template(self):
user = User.objects.create_superuser('username')
self.client.force_login(user)
response = self.client.get('/enrolment/')
self.assertTemplateUsed(response, 'enrolment/index.html')
Thank you.
Aucun commentaire:
Enregistrer un commentaire