From 6ddd0ae5ab4e9b4caf53bebcc773e9ac1eab5ea0 Mon Sep 17 00:00:00 2001 From: Usman Khalid Date: Fri, 25 Oct 2013 19:54:52 +0500 Subject: [PATCH] student.tests: Added db access in mock_render_to_response() to test any issues with @transaction.commit_manually --- common/djangoapps/student/tests/test_email.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py index 7e2d9ede00..c3e4fd0484 100644 --- a/common/djangoapps/student/tests/test_email.py +++ b/common/djangoapps/student/tests/test_email.py @@ -25,6 +25,9 @@ def mock_render_to_string(template_name, context): def mock_render_to_response(template_name, context): """Return an HttpResponse with content that encodes template_name and context""" + # View confirm_email_change uses @transaction.commit_manually. + # This simulates any db access in the templates. + UserProfile.objects.exists() return HttpResponse(mock_render_to_string(template_name, context))