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
999fc068
Kaydet (Commit)
999fc068
authored
Ock 15, 2018
tarafından
Mads Jensen
Kaydeden (comit)
Tim Graham
Ock 15, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added a few tests for smtp EmailBackend.
üst
59b1aaa5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
tests.py
tests/mail/tests.py
+24
-2
No files found.
tests/mail/tests.py
Dosyayı görüntüle @
999fc068
...
...
@@ -1334,10 +1334,16 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
open() returns whether it opened a connection.
"""
backend
=
smtp
.
EmailBackend
(
username
=
''
,
password
=
''
)
self
.
assert
Fals
e
(
backend
.
connection
)
self
.
assert
IsNon
e
(
backend
.
connection
)
opened
=
backend
.
open
()
backend
.
close
()
self
.
assertTrue
(
opened
)
self
.
assertIs
(
opened
,
True
)
def
test_reopen_connection
(
self
):
backend
=
smtp
.
EmailBackend
()
# Simulate an already open connection.
backend
.
connection
=
True
self
.
assertIs
(
backend
.
open
(),
False
)
def
test_server_login
(
self
):
"""
...
...
@@ -1366,6 +1372,14 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
backend
=
smtp
.
EmailBackend
()
self
.
assertFalse
(
backend
.
use_tls
)
def
test_ssl_tls_mutually_exclusive
(
self
):
msg
=
(
'EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive, so only set '
'one of those settings to True.'
)
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
smtp
.
EmailBackend
(
use_ssl
=
True
,
use_tls
=
True
)
@override_settings
(
EMAIL_USE_SSL
=
True
)
def
test_email_ssl_use_settings
(
self
):
backend
=
smtp
.
EmailBackend
()
...
...
@@ -1493,6 +1507,14 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
email
=
EmailMessage
(
'Subject'
,
'Content'
,
'from@example.com'
,
[
'to@example.com'
])
self
.
assertEqual
(
backend
.
send_messages
([
email
]),
None
)
def
test_send_messages_zero_sent
(
self
):
"""A message isn't sent if it doesn't have any recipients."""
backend
=
smtp
.
EmailBackend
()
backend
.
connection
=
True
email
=
EmailMessage
(
'Subject'
,
'Content'
,
'from@example.com'
,
to
=
[])
sent
=
backend
.
send_messages
([
email
])
self
.
assertEqual
(
sent
,
0
)
class
SMTPBackendStoppedServerTests
(
SMTPBackendTestsBase
):
"""
...
...
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