/usr/lib/python3/dist-packages/systemfixtures/groups.py is in python3-systemfixtures 0.6.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import grp
from fixtures import Fixture
from ._overlay import Overlay
class FakeGroups(Fixture):
def _setUp(self):
self._groups = {}
self.useFixture(Overlay("grp.getgrnam", self._getgrnam, self._is_fake))
def add(self, name, gid):
self._groups[name] = ("x", gid, [])
def _getgrnam(self, real, name):
return grp.struct_group((name,) + self._groups[name])
def _is_fake(self, name):
return name in self._groups
|