2002-07-24 03:04:11 +08:00
|
|
|
from test.test_support import verbose, TestFailed, TestSkipped
|
1996-12-11 09:01:38 +08:00
|
|
|
import nis
|
|
|
|
|
1996-12-24 07:39:42 +08:00
|
|
|
print 'nis.maps()'
|
1997-05-16 02:27:49 +08:00
|
|
|
try:
|
|
|
|
maps = nis.maps()
|
|
|
|
except nis.error, msg:
|
1999-01-28 12:54:33 +08: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
|
2000-08-04 21:34:43 +08:00
|
|
|
raise TestSkipped, msg
|
1997-05-16 02:27:49 +08:00
|
|
|
|
1996-12-12 00:28:30 +08:00
|
|
|
done = 0
|
|
|
|
for nismap in maps:
|
|
|
|
if verbose:
|
1998-03-27 03:42:58 +08:00
|
|
|
print nismap
|
1996-12-12 00:28:30 +08:00
|
|
|
mapping = nis.cat(nismap)
|
|
|
|
for k, v in mapping.items():
|
1998-03-27 03:42:58 +08:00
|
|
|
if verbose:
|
|
|
|
print ' ', k, v
|
|
|
|
if not k:
|
|
|
|
continue
|
2000-12-13 07:11:42 +08:00
|
|
|
if nis.match(k, nismap) != v:
|
1998-03-27 03:42:58 +08:00
|
|
|
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-12 00:28:30 +08:00
|
|
|
if done:
|
1998-03-27 03:42:58 +08:00
|
|
|
break
|