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
3724d6c3
Kaydet (Commit)
3724d6c3
authored
May 23, 2009
tarafından
R. David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add smtplib test from issue 5259.
üst
91d517c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
test_smtplib.py
Lib/test/test_smtplib.py
+20
-0
No files found.
Lib/test/test_smtplib.py
Dosyayı görüntüle @
3724d6c3
...
...
@@ -276,6 +276,9 @@ sim_users = {'Mr.A@somewhere.com':'John A',
'Mrs.C@somewhereesle.com'
:
'Ruth C'
,
}
sim_auth
=
(
'Mr.A@somewhere.com'
,
'somepassword'
)
sim_auth_b64encoded
=
'AE1yLkFAc29tZXdoZXJlLmNvbQBzb21lcGFzc3dvcmQ='
sim_lists
=
{
'list-1'
:[
'Mr.A@somewhere.com'
,
'Mrs.C@somewhereesle.com'
],
'list-2'
:[
'Ms.B@somewhere.com'
,],
}
...
...
@@ -288,6 +291,7 @@ class SimSMTPChannel(smtpd.SMTPChannel):
'250-SIZE 20000000
\r\n
'
\
'250-STARTTLS
\r\n
'
\
'250-DELIVERBY
\r\n
'
\
'250-AUTH PLAIN
\r\n
'
\
'250 HELP'
self
.
push
(
resp
)
...
...
@@ -316,6 +320,16 @@ class SimSMTPChannel(smtpd.SMTPChannel):
else
:
self
.
push
(
'550 No access for you!'
)
def
smtp_AUTH
(
self
,
arg
):
mech
,
auth
=
arg
.
split
()
if
mech
.
lower
()
==
'plain'
:
if
auth
==
sim_auth_b64encoded
:
self
.
push
(
'235 ok, go ahead'
)
else
:
self
.
push
(
'550 No access for you!'
)
else
:
self
.
push
(
'504 auth type unimplemented'
)
class
SimSMTPServer
(
smtpd
.
SMTPServer
):
def
handle_accept
(
self
):
...
...
@@ -364,6 +378,7 @@ class SMTPSimTests(TestCase):
'size'
:
'20000000'
,
'starttls'
:
''
,
'deliverby'
:
''
,
'auth'
:
' PLAIN'
,
'help'
:
''
,
}
...
...
@@ -401,6 +416,11 @@ class SMTPSimTests(TestCase):
self
.
assertEqual
(
smtp
.
expn
(
u
),
expected_unknown
)
smtp
.
quit
()
def
testAUTH
(
self
):
smtp
=
smtplib
.
SMTP
(
HOST
,
self
.
port
,
local_hostname
=
'localhost'
,
timeout
=
15
)
expected_auth_ok
=
(
235
,
b
'ok, go ahead'
)
self
.
assertEqual
(
smtp
.
login
(
sim_auth
[
0
],
sim_auth
[
1
]),
expected_auth_ok
)
def
test_main
(
verbose
=
None
):
...
...
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