summaryrefslogtreecommitdiff
path: root/sys/lib/python/test/test_nis.py
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
commit458120dd40db6b4df55a4e96b650e16798ef06a0 (patch)
tree8f82685be24fef97e715c6f5ca4c68d34d5074ee /sys/lib/python/test/test_nis.py
parent3a742c699f6806c1145aea5149bf15de15a0afd7 (diff)
add hg and python
Diffstat (limited to 'sys/lib/python/test/test_nis.py')
-rw-r--r--sys/lib/python/test/test_nis.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/lib/python/test/test_nis.py b/sys/lib/python/test/test_nis.py
new file mode 100644
index 000000000..74ceeea91
--- /dev/null
+++ b/sys/lib/python/test/test_nis.py
@@ -0,0 +1,39 @@
+from test.test_support import verbose, TestFailed, TestSkipped
+import nis
+
+print 'nis.maps()'
+try:
+ maps = nis.maps()
+except nis.error, msg:
+ # 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 TestSkipped, msg
+
+try:
+ # On some systems, this map is only accessible to the
+ # super user
+ maps.remove("passwd.adjunct.byname")
+except ValueError:
+ pass
+
+done = 0
+for nismap in maps:
+ if verbose:
+ print nismap
+ mapping = nis.cat(nismap)
+ for k, v in mapping.items():
+ 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
+ if done:
+ break