예제 #1
0
파일: proc.py 프로젝트: ouzel/stem
  def test_get_cwd(self, readlink_mock):
    """
    Tests the get_cwd function with a given pid.
    """

    readlink_mock.side_effect = lambda param: {
      '/proc/24019/cwd': '/home/directory/TEST'
    }[param]

    self.assertEquals('/home/directory/TEST', proc.get_cwd(24019))
예제 #2
0
파일: proc.py 프로젝트: sreenatha123/stem
  def test_get_cwd(self):
    """
    Tests the get_cwd function with a given pid.
    """

    mocking.mock(os.readlink, mocking.return_for_args({
      ('/proc/24019/cwd',): '/home/directory/TEST'
    }), os)

    self.assertEquals('/home/directory/TEST', proc.get_cwd(24019))
예제 #3
0
파일: proc.py 프로젝트: DigiThinkIT/stem
    def test_get_cwd(self, readlink_mock):
        """
    Tests the get_cwd function with a given pid.
    """

        readlink_mock.side_effect = lambda param: {
            '/proc/24019/cwd': '/home/directory/TEST'
        }[param]

        self.assertEquals('/home/directory/TEST', proc.get_cwd(24019))
예제 #4
0
  def test_get_cwd(self):
    """
    Checks that stem.util.proc.get_cwd matches our tor instance's cwd.
    """

    if not proc.is_available():
      test.runner.skip(self, "(proc unavailable)")
      return
    elif not test.runner.get_runner().is_ptraceable():
      test.runner.skip(self, "(DisableDebuggerAttachment is set)")
      return

    runner = test.runner.get_runner()
    runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
    self.assertEquals(tor_cwd, proc.get_cwd(runner_pid))
예제 #5
0
    def test_get_cwd(self):
        """
    Checks that stem.util.proc.get_cwd matches our tor instance's cwd.
    """

        if not proc.is_available():
            test.runner.skip(self, "(proc unavailable)")
            return
        elif not test.runner.get_runner().is_ptraceable():
            test.runner.skip(self, "(DisableDebuggerAttachment is set)")
            return

        runner = test.runner.get_runner()
        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEquals(tor_cwd, proc.get_cwd(runner_pid))