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
1f5425ff
Kaydet (Commit)
1f5425ff
authored
Nis 01, 2017
tarafından
Senthil Kumaran
Kaydeden (comit)
GitHub
Nis 01, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add helpful explaination to test_password_manager tests. (#936)
Also uncomment and fix a path test.
üst
b94d7fd4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
test_urllib2.py
Lib/test/test_urllib2.py
+26
-15
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
1f5425ff
...
@@ -141,44 +141,55 @@ class RequestHdrsTests(unittest.TestCase):
...
@@ -141,44 +141,55 @@ class RequestHdrsTests(unittest.TestCase):
mgr
=
urllib
.
request
.
HTTPPasswordMgr
()
mgr
=
urllib
.
request
.
HTTPPasswordMgr
()
add
=
mgr
.
add_password
add
=
mgr
.
add_password
find_user_pass
=
mgr
.
find_user_password
find_user_pass
=
mgr
.
find_user_password
add
(
"Some Realm"
,
"http://example.com/"
,
"joe"
,
"password"
)
add
(
"Some Realm"
,
"http://example.com/"
,
"joe"
,
"password"
)
add
(
"Some Realm"
,
"http://example.com/ni"
,
"ni"
,
"ni"
)
add
(
"Some Realm"
,
"http://example.com/ni"
,
"ni"
,
"ni"
)
add
(
"c"
,
"http://example.com/foo"
,
"foo"
,
"ni"
)
add
(
"c"
,
"http://example.com/bar"
,
"bar"
,
"nini"
)
add
(
"b"
,
"http://example.com/"
,
"first"
,
"blah"
)
add
(
"b"
,
"http://example.com/"
,
"second"
,
"spam"
)
add
(
"a"
,
"http://example.com"
,
"1"
,
"a"
)
add
(
"Some Realm"
,
"http://c.example.com:3128"
,
"3"
,
"c"
)
add
(
"Some Realm"
,
"http://c.example.com:3128"
,
"3"
,
"c"
)
add
(
"Some Realm"
,
"d.example.com"
,
"4"
,
"d"
)
add
(
"Some Realm"
,
"d.example.com"
,
"4"
,
"d"
)
add
(
"Some Realm"
,
"e.example.com:3128"
,
"5"
,
"e"
)
add
(
"Some Realm"
,
"e.example.com:3128"
,
"5"
,
"e"
)
# For the same realm, password set the highest path is the winner.
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"example.com"
),
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"example.com"
),
(
'joe'
,
'password'
))
(
'joe'
,
'password'
))
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"http://example.com/ni"
),
#self.assertEqual(find_user_pass("Some Realm", "http://example.com/ni"),
(
'joe'
,
'password'
))
# ('ni', 'ni'))
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"http://example.com"
),
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"http://example.com"
),
(
'joe'
,
'password'
))
(
'joe'
,
'password'
))
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"http://example.com/"
),
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"http://example.com/"
),
(
'joe'
,
'password'
))
(
'joe'
,
'password'
))
self
.
assertEqual
(
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
find_user_pass
(
"Some Realm"
,
"http://example.com/spam"
),
"http://example.com/spam"
),
(
'joe'
,
'password'
))
(
'joe'
,
'password'
))
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
"http://example.com/spam/spam"
),
self
.
assertEqual
(
find_user_pass
(
"Some Realm"
,
(
'joe'
,
'password'
))
"http://example.com/spam/spam"
),
(
'joe'
,
'password'
))
# You can have different passwords for different paths.
add
(
"c"
,
"http://example.com/foo"
,
"foo"
,
"ni"
)
add
(
"c"
,
"http://example.com/bar"
,
"bar"
,
"nini"
)
self
.
assertEqual
(
find_user_pass
(
"c"
,
"http://example.com/foo"
),
self
.
assertEqual
(
find_user_pass
(
"c"
,
"http://example.com/foo"
),
(
'foo'
,
'ni'
))
(
'foo'
,
'ni'
))
self
.
assertEqual
(
find_user_pass
(
"c"
,
"http://example.com/bar"
),
self
.
assertEqual
(
find_user_pass
(
"c"
,
"http://example.com/bar"
),
(
'bar'
,
'nini'
))
(
'bar'
,
'nini'
))
# For the same path, newer password should be considered.
add
(
"b"
,
"http://example.com/"
,
"first"
,
"blah"
)
add
(
"b"
,
"http://example.com/"
,
"second"
,
"spam"
)
self
.
assertEqual
(
find_user_pass
(
"b"
,
"http://example.com/"
),
self
.
assertEqual
(
find_user_pass
(
"b"
,
"http://example.com/"
),
(
'second'
,
'spam'
))
(
'second'
,
'spam'
))
# No special relationship between a.example.com and example.com:
# No special relationship between a.example.com and example.com:
add
(
"a"
,
"http://example.com"
,
"1"
,
"a"
)
self
.
assertEqual
(
find_user_pass
(
"a"
,
"http://example.com/"
),
self
.
assertEqual
(
find_user_pass
(
"a"
,
"http://example.com/"
),
(
'1'
,
'a'
))
(
'1'
,
'a'
))
self
.
assertEqual
(
find_user_pass
(
"a"
,
"http://a.example.com/"
),
self
.
assertEqual
(
find_user_pass
(
"a"
,
"http://a.example.com/"
),
(
None
,
None
))
(
None
,
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