def test_setuid_with_id(self): with mock.patch('os.setuid') as setuid_mock: daemon.setuid('321') setuid_mock.assert_called_once_with(321)
def test_setuid_with_name(self): with mock.patch('pwd.getpwnam', return_value=FakeEntry('pw_uid', 123)): with mock.patch('os.setuid') as setuid_mock: daemon.setuid('user') setuid_mock.assert_called_once_with(123)
def test_setuid_with_id(self): with mock.patch("os.setuid") as setuid_mock: daemon.setuid("321") setuid_mock.assert_called_once_with(321)
def test_setuid_with_name(self): with mock.patch("pwd.getpwnam", return_value=FakeEntry("pw_uid", 123)): with mock.patch("os.setuid") as setuid_mock: daemon.setuid("user") setuid_mock.assert_called_once_with(123)