(self, getpwuid, getgrall, setgroups)
| 538 | @patch('grp.getgrall') |
| 539 | @patch('pwd.getpwuid') |
| 540 | def test_without_initgroups(self, getpwuid, getgrall, setgroups): |
| 541 | prev = getattr(os, 'initgroups', None) |
| 542 | try: |
| 543 | delattr(os, 'initgroups') |
| 544 | except AttributeError: |
| 545 | pass |
| 546 | try: |
| 547 | getpwuid.return_value = ['user'] |
| 548 | |
| 549 | class grent: |
| 550 | gr_mem = ['user'] |
| 551 | |
| 552 | def __init__(self, gid): |
| 553 | self.gr_gid = gid |
| 554 | |
| 555 | getgrall.return_value = [grent(1), grent(2), grent(3)] |
| 556 | initgroups(5001, 50001) |
| 557 | setgroups.assert_called_with([1, 2, 3]) |
| 558 | finally: |
| 559 | if prev: |
| 560 | os.initgroups = prev |
| 561 | |
| 562 | |
| 563 | @t.skip.if_win32 |
nothing calls this directly
no test coverage detected