Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
6a9e6bbf
Kaydet (Commit)
6a9e6bbf
authored
Agu 04, 2010
tarafından
Richard Jones
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix test_smtplib/test_smtpd collision through pre-loaded reply data in mock_socket
üst
62f68ed3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
mock_socket.py
Lib/test/mock_socket.py
+1
-0
test_smtpd.py
Lib/test/test_smtpd.py
+4
-4
test_smtplib.py
Lib/test/test_smtplib.py
+5
-0
No files found.
Lib/test/mock_socket.py
Dosyayı görüntüle @
6a9e6bbf
...
...
@@ -36,6 +36,7 @@ class MockSocket:
self
.
lines
=
[]
if
_reply_data
:
self
.
lines
.
append
(
_reply_data
)
_reply_data
=
None
self
.
conn
=
None
self
.
timeout
=
None
...
...
Lib/test/test_smtpd.py
Dosyayı görüntüle @
6a9e6bbf
...
...
@@ -189,8 +189,8 @@ class SMTPDChannelTest(TestCase):
self
.
write_line
(
b
'RCPT To:ham@example'
)
self
.
write_line
(
b
'DATA'
)
self
.
write_line
(
b
'data
\r\n
.'
)
self
.
assertEqual
(
self
.
server
.
messages
[
-
1
]
,
(
'peer'
,
'eggs@example'
,
[
'spam@example'
,
'ham@example'
],
'data'
)
)
self
.
assertEqual
(
self
.
server
.
messages
,
[(
'peer'
,
'eggs@example'
,
[
'spam@example'
,
'ham@example'
],
'data'
)]
)
def
test_manual_status
(
self
):
# checks that the Channel is able to return a custom status message
...
...
@@ -209,8 +209,8 @@ class SMTPDChannelTest(TestCase):
self
.
write_line
(
b
'RCPT To:eggs@example'
)
self
.
write_line
(
b
'DATA'
)
self
.
write_line
(
b
'data
\r\n
.'
)
self
.
assertEqual
(
self
.
server
.
messages
[
0
]
,
(
'peer'
,
'foo@example'
,
[
'eggs@example'
],
'data'
)
)
self
.
assertEqual
(
self
.
server
.
messages
,
[(
'peer'
,
'foo@example'
,
[
'eggs@example'
],
'data'
)]
)
def
test_RSET_syntax
(
self
):
self
.
write_line
(
b
'RSET hi'
)
...
...
Lib/test/test_smtplib.py
Dosyayı görüntüle @
6a9e6bbf
...
...
@@ -64,17 +64,20 @@ class GeneralTests(unittest.TestCase):
smtp
.
close
()
def
testBasic2
(
self
):
mock_socket
.
reply_with
(
b
"220 Hola mundo"
)
# connects, include port in host name
smtp
=
smtplib
.
SMTP
(
"
%
s:
%
s"
%
(
HOST
,
self
.
port
))
smtp
.
close
()
def
testLocalHostName
(
self
):
mock_socket
.
reply_with
(
b
"220 Hola mundo"
)
# check that supplied local_hostname is used
smtp
=
smtplib
.
SMTP
(
HOST
,
self
.
port
,
local_hostname
=
"testhost"
)
self
.
assertEqual
(
smtp
.
local_hostname
,
"testhost"
)
smtp
.
close
()
def
testTimeoutDefault
(
self
):
mock_socket
.
reply_with
(
b
"220 Hola mundo"
)
self
.
assertTrue
(
mock_socket
.
getdefaulttimeout
()
is
None
)
mock_socket
.
setdefaulttimeout
(
30
)
self
.
assertEqual
(
mock_socket
.
getdefaulttimeout
(),
30
)
...
...
@@ -86,6 +89,7 @@ class GeneralTests(unittest.TestCase):
smtp
.
close
()
def
testTimeoutNone
(
self
):
mock_socket
.
reply_with
(
b
"220 Hola mundo"
)
self
.
assertTrue
(
socket
.
getdefaulttimeout
()
is
None
)
socket
.
setdefaulttimeout
(
30
)
try
:
...
...
@@ -96,6 +100,7 @@ class GeneralTests(unittest.TestCase):
smtp
.
close
()
def
testTimeoutValue
(
self
):
mock_socket
.
reply_with
(
b
"220 Hola mundo"
)
smtp
=
smtplib
.
SMTP
(
HOST
,
self
.
port
,
timeout
=
30
)
self
.
assertEqual
(
smtp
.
sock
.
gettimeout
(),
30
)
smtp
.
close
()
...
...
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