コード例 #1
0
ファイル: system.py プロジェクト: DigiThinkIT/stem
    def test_get_cwd_lsof(self):
        """
    Tests the get_pid_by_cwd function with a lsof response.
    """

        runner = test.runner.get_runner()

        if not stem.util.system.is_available('lsof'):
            test.runner.skip(self, '(lsof unavailable)')
            return
        elif not runner.is_ptraceable():
            test.runner.skip(self, '(DisableDebuggerAttachment is set)')
            return

        # filter the call function to only allow this command

        lsof_prefix = 'lsof -a -p '

        call_replacement = filter_system_call([lsof_prefix])

        with patch('stem.util.system.call') as call_mock:
            call_mock.side_effect = call_replacement

            runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
            self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))
コード例 #2
0
    def test_cwd_pwdx(self):
        """
    Tests the pid_by_cwd function with a pwdx response.
    """

        runner = test.runner.get_runner()

        if not stem.util.system.is_available('pwdx'):
            test.runner.skip(self, '(pwdx unavailable)')
            return
        elif not runner.is_ptraceable():
            test.runner.skip(self, '(DisableDebuggerAttachment is set)')
            return

        # filter the call function to only allow this command

        pwdx_prefix = stem.util.system.GET_CWD_PWDX % ''

        call_replacement = filter_system_call([pwdx_prefix])

        with patch('stem.util.system.call') as call_mock:
            call_mock.side_effect = call_replacement

            runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
            self.assertEqual(tor_cwd, stem.util.system.cwd(runner_pid))
コード例 #3
0
ファイル: system.py プロジェクト: Fuzew/sharp-stem
  def test_cwd_lsof(self):
    """
    Tests the pid_by_cwd function with a lsof response.
    """

    runner = test.runner.get_runner()

    if not stem.util.system.is_available('lsof'):
      test.runner.skip(self, '(lsof unavailable)')
      return
    elif not runner.is_ptraceable():
      test.runner.skip(self, '(DisableDebuggerAttachment is set)')
      return

    # filter the call function to only allow this command

    lsof_prefix = 'lsof -a -p '

    call_replacement = filter_system_call([lsof_prefix])

    with patch('stem.util.system.call') as call_mock:
      call_mock.side_effect = call_replacement

      runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
      self.assertEqual(tor_cwd, stem.util.system.cwd(runner_pid))
コード例 #4
0
    def test_cwd(self):
        """
    Checks that stem.util.proc.cwd matches our tor instance's cwd.
    """

        runner = test.runner.get_runner()
        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEqual(tor_cwd, proc.cwd(runner_pid))
コード例 #5
0
    def test_cwd(self):
        """
    Checks general usage of the stem.util.system.cwd function.
    """

        if stem.util.system.is_windows():
            self.skipTest('(unavailable on windows)')

        runner = test.runner.get_runner()
        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEqual(tor_cwd, stem.util.system.cwd(runner_pid))
        self.assertEqual(None, stem.util.system.cwd(99999))
コード例 #6
0
ファイル: system.py プロジェクト: jacthinman/Tor-Stem
 def test_get_cwd(self):
   """
   Checks general usage of the stem.util.system.get_cwd function.
   """
   
   runner = test.runner.get_runner()
   
   if not runner.is_ptraceable():
     self.skipTest("(DisableDebuggerAttachment is set)")
   
   runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
   self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))
   self.assertEquals(None, stem.util.system.get_cwd(99999))
コード例 #7
0
ファイル: system.py プロジェクト: patrickod/stem
  def test_cwd(self):
    """
    Checks general usage of the stem.util.system.cwd function.
    """

    if stem.util.system.is_windows():
      self.skipTest('(unavailable on windows)')
      return

    runner = test.runner.get_runner()
    runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
    self.assertEqual(tor_cwd, stem.util.system.cwd(runner_pid))
    self.assertEqual(None, stem.util.system.cwd(99999))
コード例 #8
0
ファイル: proc.py プロジェクト: bwrichte/TorFinalProject
  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))
コード例 #9
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))
コード例 #10
0
    def test_get_cwd(self):
        """
    Checks general usage of the stem.util.system.get_cwd function.
    """

        runner = test.runner.get_runner()

        if stem.util.system.is_windows():
            test.runner.skip(self, "(unavailable on windows)")
            return
        elif not runner.is_ptraceable():
            test.runner.skip(self, "(DisableDebuggerAttachment is set)")
            return

        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))
        self.assertEquals(None, stem.util.system.get_cwd(99999))
コード例 #11
0
ファイル: system.py プロジェクト: bwrichte/TorFinalProject
  def test_get_cwd(self):
    """
    Checks general usage of the stem.util.system.get_cwd function.
    """

    runner = test.runner.get_runner()

    if stem.util.system.is_windows():
      test.runner.skip(self, "(unavailable on windows)")
      return
    elif not runner.is_ptraceable():
      test.runner.skip(self, "(DisableDebuggerAttachment is set)")
      return

    runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
    self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))
    self.assertEquals(None, stem.util.system.get_cwd(99999))
コード例 #12
0
ファイル: system.py プロジェクト: rl1987/stem
    def test_cwd_lsof(self):
        """
    Tests the pid_by_cwd function with a lsof response.
    """

        # filter the call function to only allow this command

        lsof_prefix = 'lsof -a -p '

        call_replacement = filter_system_call([lsof_prefix])

        with patch('stem.util.system.call') as call_mock:
            call_mock.side_effect = call_replacement

            runner = test.runner.get_runner()
            runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
            self.assertEqual(tor_cwd, stem.util.system.cwd(runner_pid))
コード例 #13
0
ファイル: system.py プロジェクト: jacthinman/Tor-Stem
 def test_get_cwd_lsof(self):
   """
   Tests the get_pid_by_cwd function with a lsof response.
   """
   
   runner = test.runner.get_runner()
   if not stem.util.system.is_available("lsof"):
     self.skipTest("(lsof unavailable)")
   elif not runner.is_ptraceable():
     self.skipTest("(DisableDebuggerAttachment is set)")
   
   # filter the call function to only allow this command
   lsof_prefix = "lsof -a -p "
   mocking.mock(stem.util.system.call, filter_system_call([lsof_prefix]))
   
   runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
   self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))
コード例 #14
0
ファイル: system.py プロジェクト: patrickod/stem
  def test_cwd_lsof(self):
    """
    Tests the pid_by_cwd function with a lsof response.
    """

    # filter the call function to only allow this command

    lsof_prefix = 'lsof -a -p '

    call_replacement = filter_system_call([lsof_prefix])

    with patch('stem.util.system.call') as call_mock:
      call_mock.side_effect = call_replacement

      runner = test.runner.get_runner()
      runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
      self.assertEqual(tor_cwd, stem.util.system.cwd(runner_pid))
コード例 #15
0
    def test_get_cwd_lsof(self):
        """
    Tests the get_pid_by_cwd function with a lsof response.
    """

        runner = test.runner.get_runner()
        if not stem.util.system.is_available("lsof"):
            test.runner.skip(self, "(lsof unavailable)")
            return
        elif not runner.is_ptraceable():
            test.runner.skip(self, "(DisableDebuggerAttachment is set)")
            return

        # filter the call function to only allow this command
        lsof_prefix = "lsof -a -p "
        mocking.mock(stem.util.system.call, filter_system_call([lsof_prefix]))

        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))
コード例 #16
0
ファイル: system.py プロジェクト: bwrichte/TorFinalProject
  def test_get_cwd_pwdx(self):
    """
    Tests the get_pid_by_cwd function with a pwdx response.
    """

    runner = test.runner.get_runner()
    if not stem.util.system.is_available("pwdx"):
      test.runner.skip(self, "(pwdx unavailable)")
      return
    elif not runner.is_ptraceable():
      test.runner.skip(self, "(DisableDebuggerAttachment is set)")
      return

    # filter the call function to only allow this command
    pwdx_prefix = stem.util.system.GET_CWD_PWDX % ""
    mocking.mock(stem.util.system.call, filter_system_call([pwdx_prefix]))

    runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
    self.assertEquals(tor_cwd, stem.util.system.get_cwd(runner_pid))