Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
ba37ac74
Kaydet (Commit)
ba37ac74
authored
Mar 20, 2015
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapted sendtestemail to be more argparse-ish
üst
0d9b018e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
11 deletions
+5
-11
sendtestemail.py
django/core/management/commands/sendtestemail.py
+5
-4
test_sendtestemail.py
tests/mail/test_sendtestemail.py
+0
-7
No files found.
django/core/management/commands/sendtestemail.py
Dosyayı görüntüle @
ba37ac74
...
...
@@ -7,14 +7,15 @@ from django.core.management.base import BaseCommand, CommandError
class
Command
(
BaseCommand
):
help
=
"Sends a test email to the email addresses specified as arguments."
args
=
"<email1 email2 ...>"
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
'email'
,
nargs
=
'+'
,
help
=
'One or more email addresses to send the test mail to.'
)
def
handle
(
self
,
*
args
,
**
kwargs
):
if
not
args
:
raise
CommandError
(
'You must provide at least one destination email.'
)
send_mail
(
subject
=
'Test email from
%
s on
%
s'
%
(
socket
.
gethostname
(),
datetime
.
datetime
.
now
()),
message
=
"If you
\'
re reading this, it was successful."
,
from_email
=
None
,
recipient_list
=
args
,
recipient_list
=
kwargs
[
'email'
]
,
)
tests/mail/test_sendtestemail.py
Dosyayı görüntüle @
ba37ac74
...
...
@@ -32,10 +32,3 @@ class SendTestEmailManagementCommand(SimpleTestCase):
mail_message
=
mail
.
outbox
[
0
]
self
.
assertEqual
(
mail_message
.
subject
[
0
:
15
],
'Test email from'
)
self
.
assertEqual
(
mail_message
.
recipients
(),
recipients
)
def
test_send_test_email_missing_recipient
(
self
):
"""
A CommandError is raised if no recipients are specified.
"""
with
self
.
assertRaisesMessage
(
CommandError
,
'You must provide at least one destination email'
):
call_command
(
"sendtestemail"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment