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
ecd2fdca
Kaydet (Commit)
ecd2fdca
authored
Nis 22, 2003
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change test_pwd and test_grp so they can handle duplicate user
and group names. This should fix SF bug #724771.
üst
41c9f880
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
test_grp.py
Lib/test/test_grp.py
+4
-2
test_pwd.py
Lib/test/test_pwd.py
+3
-1
No files found.
Lib/test/test_grp.py
Dosyayı görüntüle @
ecd2fdca
...
...
@@ -9,6 +9,7 @@ class GroupDatabaseTestCase(unittest.TestCase):
def
test_values
(
self
):
entries
=
grp
.
getgrall
()
entriesbyname
=
{}
entriesbygid
=
{}
for
e
in
entries
:
...
...
@@ -22,18 +23,19 @@ class GroupDatabaseTestCase(unittest.TestCase):
self
.
assertEqual
(
e
[
3
],
e
.
gr_mem
)
self
.
assert_
(
isinstance
(
e
.
gr_mem
,
list
))
self
.
assertEqual
(
grp
.
getgrnam
(
e
.
gr_name
),
e
)
# The following won't work, because of duplicate entries
# for one gid
# self.assertEqual(grp.getgrgid(e.gr_gid), e)
# instead of this collect all entries for one gid
# instead of this collect all entries for one gid
/name
# and check afterwards
entriesbyname
.
setdefault
(
e
.
gr_name
,
[])
.
append
(
e
)
entriesbygid
.
setdefault
(
e
.
gr_gid
,
[])
.
append
(
e
)
# check whether the entry returned by getgrgid()
# for each uid is among those from getgrall() for this uid
for
e
in
entries
:
self
.
assert_
(
grp
.
getgrgid
(
e
.
gr_gid
)
in
entriesbygid
[
e
.
gr_gid
])
self
.
assert_
(
grp
.
getgrnam
(
e
.
gr_name
)
in
entriesbyname
[
e
.
gr_name
])
def
test_errors
(
self
):
self
.
assertRaises
(
TypeError
,
grp
.
getgrgid
)
...
...
Lib/test/test_pwd.py
Dosyayı görüntüle @
ecd2fdca
...
...
@@ -7,6 +7,7 @@ class PwdTest(unittest.TestCase):
def
test_values
(
self
):
entries
=
pwd
.
getpwall
()
entriesbyname
=
{}
entriesbyuid
=
{}
for
e
in
entries
:
...
...
@@ -26,17 +27,18 @@ class PwdTest(unittest.TestCase):
self
.
assertEqual
(
e
[
6
],
e
.
pw_shell
)
self
.
assert_
(
isinstance
(
e
.
pw_shell
,
basestring
))
self
.
assertEqual
(
pwd
.
getpwnam
(
e
.
pw_name
),
e
)
# The following won't work, because of duplicate entries
# for one uid
# self.assertEqual(pwd.getpwuid(e.pw_uid), e)
# instead of this collect all entries for one uid
# and check afterwards
entriesbyname
.
setdefault
(
e
.
pw_name
,
[])
.
append
(
e
)
entriesbyuid
.
setdefault
(
e
.
pw_uid
,
[])
.
append
(
e
)
# check whether the entry returned by getpwuid()
# for each uid is among those from getpwall() for this uid
for
e
in
entries
:
self
.
assert_
(
pwd
.
getpwnam
(
e
.
pw_name
)
in
entriesbyname
[
e
.
pw_name
])
self
.
assert_
(
pwd
.
getpwuid
(
e
.
pw_uid
)
in
entriesbyuid
[
e
.
pw_uid
])
def
test_errors
(
self
):
...
...
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