Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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__)
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()