Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modified the test_client tests to use the non-deprecated mail API.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c7384af0614ddfc960d03c6704c53058a99f32c3 1 parent 65dc518
Russell Keith-Magee freakboy3742 authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 tests/modeltests/test_client/views.py
14 tests/modeltests/test_client/views.py
View
@@ -1,6 +1,6 @@
from xml.dom.minidom import parseString
-from django.core.mail import EmailMessage, SMTPConnection
+from django.core import mail
from django.template import Context, Template
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.contrib.auth.decorators import login_required, permission_required
@@ -38,7 +38,7 @@ def view_with_header(request):
response = HttpResponse()
response['X-DJANGO-TEST'] = 'Slartibartfast'
return response
-
+
def raw_post_view(request):
"""A view which expects raw XML to be posted and returns content extracted
from the XML"""
@@ -139,7 +139,7 @@ def login_protected_view_changed_redirect(request):
"A simple view that is login protected with a custom redirect field set"
t = Template('This is a login protected test. Username is {{ user.username }}.', name='Login Template')
c = Context({'user': request.user})
-
+
return HttpResponse(t.render(c))
login_protected_view_changed_redirect = login_required(redirect_field_name="redirect_to")(login_protected_view_changed_redirect)
@@ -189,7 +189,7 @@ def broken_view(request):
raise KeyError("Oops! Looks like you wrote some bad code.")
def mail_sending_view(request):
- EmailMessage(
+ mail.EmailMessage(
"Test message",
"This is a test email",
"from@example.com",
@@ -197,18 +197,18 @@ def mail_sending_view(request):
return HttpResponse("Mail sent")
def mass_mail_sending_view(request):
- m1 = EmailMessage(
+ m1 = mail.EmailMessage(
'First Test message',
'This is the first test email',
'from@example.com',
['first@example.com', 'second@example.com'])
- m2 = EmailMessage(
+ m2 = mail.EmailMessage(
'Second Test message',
'This is the second test email',
'from@example.com',
['second@example.com', 'third@example.com'])
- c = SMTPConnection()
+ c = mail.get_connection()
c.send_messages([m1,m2])
return HttpResponse("Mail sent")
Please sign in to comment.
Something went wrong with that request. Please try again.