Beispiel #1
0
 def test_posix(self, uid, gid, expected, mocker):
     """Test getting user and group id when host system is Posix"""
     mocker.patch("os.name", new="posix")
     mocker.patch("os.getuid", return_value=123)
     pw_gid = mocker.Mock()
     pw_gid.pw_gid = 456
     mocker.patch("pwd.getpwuid", return_value=pw_gid)
     assert get_uid_gid(uid, gid) == expected
Beispiel #2
0
 def test_windows(self, uid, gid, expected, mocker):
     """Test getting user and group id when host system is Windows"""
     mocker.patch("os.name", new="windows")
     assert get_uid_gid(uid, gid) == expected