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