How to use the sshtunnel._cli_main function in sshtunnel

To help you get started, we’ve selected a few sshtunnel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pahaz / sshtunnel / tests / test_forwarder.py View on Github external
def test_show_running_version(self):
        """ Test that _cli_main() function quits when Enter is pressed """
        with capture_stdout_stderr() as (out, err):
            with self.assertRaises(SystemExit):
                sshtunnel._cli_main(args=['-V'])
        if sys.version_info < (3, 4):
            version = err.getvalue().split()[-1]
        else:
            version = out.getvalue().split()[-1]
        self.assertEqual(version,
                         sshtunnel.__version__)
github pahaz / sshtunnel / tests / test_forwarder.py View on Github external
def test_cli_main_exits_when_pressing_enter(self, input):
        """ Test that _cli_main() function quits when Enter is pressed """
        self.start_echo_and_ssh_server()
        sshtunnel._cli_main(args=[self.saddr,
                                  '-U', SSH_USERNAME,
                                  '-P', SSH_PASSWORD,
                                  '-p', str(self.sport),
                                  '-R', '{0}:{1}'.format(self.eaddr,
                                                         self.eport),
                                  '-c', '',
                                  '-n'])
        self.stop_echo_and_ssh_server()