def test_uid(self): """ Checks that stem.util.proc.uid matches our tor instance's uid. """ tor_pid = test.runner.get_runner().get_pid() self.assertEqual(os.geteuid(), proc.uid(tor_pid))
def test_uid(self): """ Checks that stem.util.proc.uid matches our tor instance's uid. """ if not proc.is_available(): test.runner.skip(self, '(proc unavailable)') return tor_pid = test.runner.get_runner().get_pid() self.assertEqual(os.geteuid(), proc.uid(tor_pid))
def test_uid(self, get_line_mock): """ Tests the uid function with a given pid. """ for test_value in [(24019, 11111), (0, 22222)]: pid, uid = test_value get_line_mock.side_effect = lambda *params: { ('/proc/%s/status' % pid, 'Uid:', 'uid'): 'Uid: %s' % uid, }[params] self.assertEqual(uid, proc.uid(pid))