1997-05-15 20:27:49 +02:00
|
|
|
from test_support import verbose, TestFailed
|
1996-12-11 02:01:38 +01:00
|
|
|
import nis
|
|
|
|
|
1996-12-24 00:39:42 +01:00
|
|
|
print 'nis.maps()'
|
1997-05-15 20:27:49 +02:00
|
|
|
try:
|
|
|
|
maps = nis.maps()
|
|
|
|
except nis.error, msg:
|
1999-01-28 05:54:33 +01:00
|
|
|
# NIS is probably not active, so this test isn't useful
|
|
|
|
if verbose:
|
|
|
|
raise TestFailed, msg
|
|
|
|
# only do this if running under the regression suite
|
|
|
|
raise ImportError, msg
|
1997-05-15 20:27:49 +02:00
|
|
|
|
1996-12-11 17:28:30 +01:00
|
|
|
done = 0
|
|
|
|
for nismap in maps:
|
|
|
|
if verbose:
|
1998-03-26 20:42:58 +01:00
|
|
|
print nismap
|
1996-12-11 17:28:30 +01:00
|
|
|
mapping = nis.cat(nismap)
|
|
|
|
for k, v in mapping.items():
|
1998-03-26 20:42:58 +01: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 17:28:30 +01:00
|
|
|
if done:
|
1998-03-26 20:42:58 +01:00
|
|
|
break
|