(self, getpwuid, getgrall, setgroups)
| 388 | @patch('grp.getgrall') |
| 389 | @patch('pwd.getpwuid') |
| 390 | def test_without_initgroups(self, getpwuid, getgrall, setgroups): |
| 391 | prev = getattr(os, 'initgroups', None) |
| 392 | try: |
| 393 | delattr(os, 'initgroups') |
| 394 | except AttributeError: |
| 395 | pass |
| 396 | try: |
| 397 | getpwuid.return_value = ['user'] |
| 398 | |
| 399 | class grent: |
| 400 | gr_mem = ['user'] |
| 401 | |
| 402 | def __init__(self, gid): |
| 403 | self.gr_gid = gid |
| 404 | |
| 405 | getgrall.return_value = [grent(1), grent(2), grent(3)] |
| 406 | initgroups(5001, 50001) |
| 407 | setgroups.assert_called_with([1, 2, 3]) |
| 408 | finally: |
| 409 | if prev: |
| 410 | os.initgroups = prev |
| 411 | |
| 412 | |
| 413 | @t.skip.if_win32 |
nothing calls this directly
no test coverage detected