/usr/lib/python3/dist-packages/systemfixtures/users.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 22 | import pwd
from fixtures import Fixture
from ._overlay import Overlay
class FakeUsers(Fixture):
def _setUp(self):
self._users = {}
self.useFixture(Overlay("pwd.getpwnam", self._getpwnam, self._is_fake))
def add(self, name, uid):
self._users[name] = (
"x", uid, uid, name, "/home/{}".format(name), "/bin/bash")
def _getpwnam(self, real, name):
return pwd.struct_passwd((name,) + self._users[name])
def _is_fake(self, name):
return name in self._users
|