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
e32a8a99
Kaydet (Commit)
e32a8a99
authored
Ara 05, 2014
tarafından
Diego Guimarães
Kaydeden (comit)
Tim Graham
Ara 06, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #23947 -- Isolated a mail test.
üst
5281d962
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
tests.py
tests/mail/tests.py
+28
-17
No files found.
tests/mail/tests.py
Dosyayı görüntüle @
e32a8a99
...
...
@@ -886,12 +886,11 @@ class FakeSMTPServer(smtpd.SMTPServer, threading.Thread):
self
.
join
()
class
SMTPBackendTests
(
BaseEmailBackendTests
,
SimpleTestCase
):
email_backend
=
'django.core.mail.backends.smtp.EmailBackend'
class
SMTPBackendTestsBase
(
SimpleTestCase
):
@classmethod
def
setUpClass
(
cls
):
super
(
SMTPBackendTests
,
cls
)
.
setUpClass
()
super
(
SMTPBackendTests
Base
,
cls
)
.
setUpClass
()
cls
.
server
=
FakeSMTPServer
((
'127.0.0.1'
,
0
),
None
)
cls
.
_settings_override
=
override_settings
(
EMAIL_HOST
=
"127.0.0.1"
,
...
...
@@ -903,7 +902,11 @@ class SMTPBackendTests(BaseEmailBackendTests, SimpleTestCase):
def
tearDownClass
(
cls
):
cls
.
_settings_override
.
disable
()
cls
.
server
.
stop
()
super
(
SMTPBackendTests
,
cls
)
.
tearDownClass
()
super
(
SMTPBackendTestsBase
,
cls
)
.
tearDownClass
()
class
SMTPBackendTests
(
BaseEmailBackendTests
,
SMTPBackendTestsBase
):
email_backend
=
'django.core.mail.backends.smtp.EmailBackend'
def
setUp
(
self
):
super
(
SMTPBackendTests
,
self
)
.
setUp
()
...
...
@@ -966,19 +969,6 @@ class SMTPBackendTests(BaseEmailBackendTests, SimpleTestCase):
backend
.
close
()
self
.
assertTrue
(
opened
)
def
test_server_stopped
(
self
):
"""
Test that closing the backend while the SMTP server is stopped doesn't
raise an exception.
"""
backend
=
smtp
.
EmailBackend
(
username
=
''
,
password
=
''
)
backend
.
open
()
self
.
server
.
stop
()
try
:
backend
.
close
()
except
Exception
as
e
:
self
.
fail
(
"close() unexpectedly raised an exception:
%
s"
%
e
)
@override_settings
(
EMAIL_USE_TLS
=
True
)
def
test_email_tls_use_settings
(
self
):
backend
=
smtp
.
EmailBackend
()
...
...
@@ -1110,3 +1100,24 @@ class SMTPBackendTests(BaseEmailBackendTests, SimpleTestCase):
finally
:
SMTP
.
send
=
send
class
SMTPBackendStoppedServerTest
(
SMTPBackendTestsBase
):
"""
This test requires a separate class, because it shuts down the
FakeSMTPServer started in setUpClass(). It cannot be restarted
("RuntimeError: threads can only be started once").
"""
def
test_server_stopped
(
self
):
"""
Test that closing the backend while the SMTP server is stopped doesn't
raise an exception.
"""
backend
=
smtp
.
EmailBackend
(
username
=
''
,
password
=
''
)
backend
.
open
()
self
.
server
.
stop
()
try
:
backend
.
close
()
except
Exception
as
e
:
self
.
fail
(
"close() unexpectedly raised an exception:
%
s"
%
e
)
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