1997-05-15 15:27:49 -03:00
|
|
|
from test_support import verbose, TestFailed
|
1996-12-10 21:01:38 -04:00
|
|
|
import nis
|
|
|
|
|
1996-12-23 19:39:42 -04:00
|
|
|
print 'nis.maps()'
|
1997-05-15 15:27:49 -03:00
|
|
|
try:
|
|
|
|
# the following could fail if NIS isn't active
|
|
|
|
maps = nis.maps()
|
|
|
|
except nis.error, msg:
|
|
|
|
raise TestFailed, msg
|
|
|
|
|
1996-12-11 12:28:30 -04:00
|
|
|
done = 0
|
|
|
|
for nismap in maps:
|
|
|
|
if verbose:
|
1998-03-26 15:42:58 -04:00
|
|
|
print nismap
|
1996-12-11 12:28:30 -04:00
|
|
|
mapping = nis.cat(nismap)
|
|
|
|
for k, v in mapping.items():
|
1998-03-26 15:42:58 -04:00
|
|
|
if verbose:
|
|
|
|
print ' ', k, v
|
|
|
|
if not k:
|
|
|
|
continue
|
|
|
|
if nis.match(k, nismap) <> v:
|
|
|
|
print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
|
|
|
|
else:
|
|
|
|
# just test the one key, otherwise this test could take a
|
|
|
|
# very long time
|
|
|
|
done = 1
|
|
|
|
break
|
1996-12-11 12:28:30 -04:00
|
|
|
if done:
|
1998-03-26 15:42:58 -04:00
|
|
|
break
|