Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Modified the test_client tests to use the non-deprecated mail…

… API.

Backport of r14187 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3c8bc8c64b2620e44275ff703c47b77cc77a0c59 1 parent 23ecf3c
Russell Keith-Magee authored October 12, 2010

Showing 1 changed file with 7 additions and 7 deletions. Show diff stats Hide diff stats

  1. 14  tests/modeltests/test_client/views.py
14  tests/modeltests/test_client/views.py
... ...
@@ -1,6 +1,6 @@
1 1
 from xml.dom.minidom import parseString
2 2
 
3  
-from django.core.mail import EmailMessage, SMTPConnection
  3
+from django.core import mail
4 4
 from django.template import Context, Template
5 5
 from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
6 6
 from django.contrib.auth.decorators import login_required, permission_required
@@ -38,7 +38,7 @@ def view_with_header(request):
38 38
     response = HttpResponse()
39 39
     response['X-DJANGO-TEST'] = 'Slartibartfast'
40 40
     return response
41  
-        
  41
+
42 42
 def raw_post_view(request):
43 43
     """A view which expects raw XML to be posted and returns content extracted
44 44
     from the XML"""
@@ -139,7 +139,7 @@ def login_protected_view_changed_redirect(request):
139 139
     "A simple view that is login protected with a custom redirect field set"
140 140
     t = Template('This is a login protected test. Username is {{ user.username }}.', name='Login Template')
141 141
     c = Context({'user': request.user})
142  
-    
  142
+
143 143
     return HttpResponse(t.render(c))
144 144
 login_protected_view_changed_redirect = login_required(redirect_field_name="redirect_to")(login_protected_view_changed_redirect)
145 145
 
@@ -189,7 +189,7 @@ def broken_view(request):
189 189
     raise KeyError("Oops! Looks like you wrote some bad code.")
190 190
 
191 191
 def mail_sending_view(request):
192  
-    EmailMessage(
  192
+    mail.EmailMessage(
193 193
         "Test message",
194 194
         "This is a test email",
195 195
         "from@example.com",
@@ -197,18 +197,18 @@ def mail_sending_view(request):
197 197
     return HttpResponse("Mail sent")
198 198
 
199 199
 def mass_mail_sending_view(request):
200  
-    m1 = EmailMessage(
  200
+    m1 = mail.EmailMessage(
201 201
         'First Test message',
202 202
         'This is the first test email',
203 203
         'from@example.com',
204 204
         ['first@example.com', 'second@example.com'])
205  
-    m2 = EmailMessage(
  205
+    m2 = mail.EmailMessage(
206 206
         'Second Test message',
207 207
         'This is the second test email',
208 208
         'from@example.com',
209 209
         ['second@example.com', 'third@example.com'])
210 210
 
211  
-    c = SMTPConnection()
  211
+    c = mail.get_connection()
212 212
     c.send_messages([m1,m2])
213 213
 
214 214
     return HttpResponse("Mail sent")

0 notes on commit 3c8bc8c

Please sign in to comment.
Something went wrong with that request. Please try again.