Пример #1
0
  def test_get_uid(self):
    """
    Checks that stem.util.proc.get_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.assertEquals(os.geteuid(), proc.get_uid(tor_pid))
Пример #2
0
    def test_get_uid(self):
        """
    Checks that stem.util.proc.get_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.assertEquals(os.geteuid(), proc.get_uid(tor_pid))
Пример #3
0
  def test_get_uid(self):
    """
    Tests the get_uid function with a given pid.
    """

    for test_value in [(24019, 11111), (0, 22222)]:
      pid, uid = test_value
      mocking.mock(proc._get_line, mocking.return_for_args({
        ("/proc/%s/status" % pid, 'Uid:', 'uid'): 'Uid: %s' % uid
      }))

      self.assertEquals(uid, proc.get_uid(pid))
Пример #4
0
Файл: proc.py Проект: ouzel/stem
  def test_get_uid(self, get_line_mock):
    """
    Tests the get_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.assertEquals(uid, proc.get_uid(pid))
Пример #5
0
    def test_get_uid(self, get_line_mock):
        """
    Tests the get_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.assertEquals(uid, proc.get_uid(pid))