def test_incorrect_format_target_machine_string_two_colons(self, getpass): getpass.return_value = 'abc123' with self.assertRaises(SystemExit): metroclient.main([ 'main.py', 'user@localmachine:55:33', 'localhost:%d' % self.metro_server_port ])
def test_successfu_connection_password_given_later(self, getpass): getpass.return_value = 'abc123' metroclient.main([ 'main.py', 'user@localhost:2222', 'localhost:%d' % self.metro_server_port ])
def test_incorrect_format_target_machine_slash_misplaced(self, getpass): getpass.return_value = 'abc123' with self.assertRaises(SystemExit): metroclient.main([ 'main.py', 'username@localmachine/misplaced', 'localhost:%d' % self.metro_server_port ])
def test_no_target_machine_argument(self, getpass): getpass.return_value = 'abc123' with self.assertRaises(SystemExit): metroclient.main(['main.py', 'metroserver.com'])
def test_no_metro_server_argument(self, getpass): getpass.return_value = 'abc123' with self.assertRaises(SystemExit): metroclient.main(['main.py', 'testuser@localmachine'])
def test_no_arguments_passed(self, getpass): getpass.return_value = 'abc123' with self.assertRaises(SystemExit): metroclient.main(['main.py'])
def test_connection_to_not_refused_port(self): with self.assertRaises(SystemExit): metroclient.main([ 'main.py', 'user/test123@localhost:15', 'localhost:%d' % self.metro_server_port ])
def test_connection_failure_to_ssh_tunnel(self): with self.assertRaises(SystemExit): metroclient.main([ 'main.py', 'user/[email protected]:2222', 'localhost:%d' % self.metro_server_port ])
def test_successful_connection_password_included(self): metroclient.main([ 'main.py', 'user/test123@localhost:2222', 'localhost:%d' % self.metro_server_port ])
def test_password_included_in_target_machine_string(self): metroclient.main([ 'main.py', 'user/test123@localhost:2222', 'localhost:%d' % self.metro_server_port ])