mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
skip NIS entries, empty entries, etc
This commit is contained in:
parent
80768f8635
commit
0e664e15ef
2 changed files with 4 additions and 2 deletions
|
@ -42,6 +42,8 @@ class GroupDatabaseTestCase(unittest.TestCase):
|
||||||
bynames = {}
|
bynames = {}
|
||||||
bygids = {}
|
bygids = {}
|
||||||
for (n, p, g, mem) in grp.getgrall():
|
for (n, p, g, mem) in grp.getgrall():
|
||||||
|
if not n or n == '+':
|
||||||
|
continue # skip NIS entries etc.
|
||||||
bynames[n] = g
|
bynames[n] = g
|
||||||
bygids[g] = n
|
bygids[g] = n
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ class PwdTest(unittest.TestCase):
|
||||||
# check whether the entry returned by getpwuid()
|
# check whether the entry returned by getpwuid()
|
||||||
# for each uid is among those from getpwall() for this uid
|
# for each uid is among those from getpwall() for this uid
|
||||||
for e in entries:
|
for e in entries:
|
||||||
if e[0] == '+':
|
if not e[0] or e[0] == '+':
|
||||||
continue # skip NIS entries
|
continue # skip NIS entries etc.
|
||||||
self.assert_(pwd.getpwnam(e.pw_name) in entriesbyname[e.pw_name])
|
self.assert_(pwd.getpwnam(e.pw_name) in entriesbyname[e.pw_name])
|
||||||
self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid])
|
self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue