MCPcopy Create free account
hub / github.com/celery/celery / test_without_initgroups

Method test_without_initgroups

t/unit/utils/test_platforms.py:540–560  ·  view source on GitHub ↗
(self, getpwuid, getgrall, setgroups)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

initgroupsFunction · 0.90
grentClass · 0.70

Tested by

no test coverage detected