コード例 #1
0
ファイル: test_daemon.py プロジェクト: williamwang0/MusicGen
 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
ファイル: test_daemon.py プロジェクト: williamwang0/MusicGen
 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
ファイル: test_daemon.py プロジェクト: ya-isakov/neutron
 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
ファイル: test_daemon.py プロジェクト: ya-isakov/neutron
 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)