def test_setgid_with_id(self): with mock.patch('os.setgid') as setgid_mock: daemon.setgid('321') setgid_mock.assert_called_once_with(321)
def test_setgid_with_name(self): with mock.patch('grp.getgrnam', return_value=FakeEntry('gr_gid', 123)): with mock.patch('os.setgid') as setgid_mock: daemon.setgid('group') setgid_mock.assert_called_once_with(123)
def test_setgid_with_id(self): with mock.patch("os.setgid") as setgid_mock: daemon.setgid("321") setgid_mock.assert_called_once_with(321)
def test_setgid_with_name(self): with mock.patch("grp.getgrnam", return_value=FakeEntry("gr_gid", 123)): with mock.patch("os.setgid") as setgid_mock: daemon.setgid("group") setgid_mock.assert_called_once_with(123)