Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_posix.PosixGroupsTester Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_initgroups
def test_setgroups

Public Attributes

 saved_groups

Detailed Description

Definition at line 429 of file test_posix.py.


Member Function Documentation

Definition at line 431 of file test_posix.py.

00431 
00432     def setUp(self):
00433         if posix.getuid() != 0:
00434             raise unittest.SkipTest("not enough privileges")
00435         if not hasattr(posix, 'getgroups'):
00436             raise unittest.SkipTest("need posix.getgroups")
00437         if sys.platform == 'darwin':
00438             raise unittest.SkipTest("getgroups(2) is broken on OSX")
00439         self.saved_groups = posix.getgroups()

Here is the caller graph for this function:

Definition at line 440 of file test_posix.py.

00440 
00441     def tearDown(self):
00442         if hasattr(posix, 'setgroups'):
00443             posix.setgroups(self.saved_groups)
00444         elif hasattr(posix, 'initgroups'):
00445             name = pwd.getpwuid(posix.getuid()).pw_name
00446             posix.initgroups(name, self.saved_groups[0])

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 449 of file test_posix.py.

00449 
00450     def test_initgroups(self):
00451         # find missing group
00452 
00453         g = max(self.saved_groups) + 1
00454         name = pwd.getpwuid(posix.getuid()).pw_name
00455         posix.initgroups(name, g)
00456         self.assertIn(g, posix.getgroups())

Here is the call graph for this function:

Definition at line 459 of file test_posix.py.

00459 
00460     def test_setgroups(self):
00461         for groups in [[0], list(range(16))]:
00462             posix.setgroups(groups)
00463             self.assertListEqual(groups, posix.getgroups())
00464 

Here is the call graph for this function:


Member Data Documentation

Definition at line 438 of file test_posix.py.


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