1996-12-18 15:36:34 -04:00
|
|
|
#! /usr/bin/env python
|
|
|
|
"""Test script for the grp module
|
|
|
|
Roger E. Masse
|
|
|
|
"""
|
2000-10-23 14:22:08 -03:00
|
|
|
|
1996-12-18 15:36:34 -04:00
|
|
|
import grp
|
2001-01-17 17:51:36 -04:00
|
|
|
from test_support import verbose
|
1996-12-18 15:36:34 -04:00
|
|
|
|
|
|
|
groups = grp.getgrall()
|
|
|
|
if verbose:
|
|
|
|
print 'Groups:'
|
|
|
|
for group in groups:
|
1998-03-26 15:42:58 -04:00
|
|
|
print group
|
1996-12-18 15:36:34 -04:00
|
|
|
|
1997-12-15 10:57:19 -04:00
|
|
|
if not groups:
|
|
|
|
if verbose:
|
1998-03-26 15:42:58 -04:00
|
|
|
print "Empty Group Database -- no further tests of grp module possible"
|
1997-12-15 10:57:19 -04:00
|
|
|
else:
|
|
|
|
group = grp.getgrgid(groups[0][2])
|
|
|
|
if verbose:
|
1998-03-26 15:42:58 -04:00
|
|
|
print 'Group Entry for GID %d: %s' % (groups[0][2], group)
|
1996-12-18 15:36:34 -04:00
|
|
|
|
1997-12-15 10:57:19 -04:00
|
|
|
group = grp.getgrnam(groups[0][0])
|
|
|
|
if verbose:
|
1998-03-26 15:42:58 -04:00
|
|
|
print 'Group Entry for group %s: %s' % (groups[0][0], group)
|