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