예제 #1
0
 def test_setuid_with_id(self):
     with mock.patch('os.setuid') as setuid_mock:
         daemon.setuid('321')
         setuid_mock.assert_called_once_with(321)
예제 #2
0
 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)
예제 #3
0
 def test_setuid_with_id(self):
     with mock.patch('os.setuid') as setuid_mock:
         daemon.setuid('321')
         setuid_mock.assert_called_once_with(321)
예제 #4
0
 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)
예제 #5
0
 def test_setuid_with_id(self):
     with mock.patch("os.setuid") as setuid_mock:
         daemon.setuid("321")
         setuid_mock.assert_called_once_with(321)
예제 #6
0
 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)