Example #1
0
 def test_setgid_with_id(self):
     with mock.patch('os.setgid') as setgid_mock:
         daemon.setgid('321')
         setgid_mock.assert_called_once_with(321)
Example #2
0
 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)
Example #3
0
 def test_setgid_with_id(self):
     with mock.patch('os.setgid') as setgid_mock:
         daemon.setgid('321')
         setgid_mock.assert_called_once_with(321)
Example #4
0
 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)
Example #5
0
 def test_setgid_with_id(self):
     with mock.patch("os.setgid") as setgid_mock:
         daemon.setgid("321")
         setgid_mock.assert_called_once_with(321)
Example #6
0
 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)