Back to index

python3.2  3.2.2
Public Member Functions
test.test_nis.NisTests Class Reference

List of all members.

Public Member Functions

def test_maps

Detailed Description

Definition at line 9 of file test_nis.py.


Member Function Documentation

Definition at line 10 of file test_nis.py.

00010 
00011     def test_maps(self):
00012         try:
00013             maps = nis.maps()
00014         except nis.error as msg:
00015             # NIS is probably not active, so this test isn't useful
00016             if support.verbose:
00017                 print("Test Skipped:", msg)
00018             # Can't raise SkipTest as regrtest only recognizes the exception
00019             #   import time.
00020             return
00021         try:
00022             # On some systems, this map is only accessible to the
00023             # super user
00024             maps.remove("passwd.adjunct.byname")
00025         except ValueError:
00026             pass
00027 
00028         done = 0
00029         for nismap in maps:
00030             mapping = nis.cat(nismap)
00031             for k, v in mapping.items():
00032                 if not k:
00033                     continue
00034                 if nis.match(k, nismap) != v:
00035                     self.fail("NIS match failed for key `%s' in map `%s'" % (k, nismap))
00036                 else:
00037                     # just test the one key, otherwise this test could take a
00038                     # very long time
00039                     done = 1
00040                     break
00041             if done:
00042                 break

Here is the call graph for this function:


The documentation for this class was generated from the following file: