Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_address(self):
""" Test that an exception is raised with incorrect bind addresses """
address_list = [('10.0.0.1', 10000),
('10.0.0.1', 10001)]
if os.name == 'posix': # UNIX sockets supported by the platform
address_list.append('/tmp/unix-socket')
self.assertIsNone(sshtunnel.check_addresses(address_list))
# UNIX sockets not supported on remote addresses
with self.assertRaises(AssertionError):
sshtunnel.check_addresses(address_list, is_remote=True)
with self.assertRaises(ValueError):
sshtunnel.check_address('this is not valid')
with self.assertRaises(ValueError):
sshtunnel.check_address(-1) # that's not valid either
def check_address(self):
""" Test that an exception is raised with incorrect bind addresses """
address_list = [('10.0.0.1', 10000),
('10.0.0.1', 10001)]
if os.name == 'posix': # UNIX sockets supported by the platform
address_list.append('/tmp/unix-socket')
self.assertIsNone(sshtunnel.check_addresses(address_list))
# UNIX sockets not supported on remote addresses
with self.assertRaises(AssertionError):
sshtunnel.check_addresses(address_list, is_remote=True)
with self.assertRaises(ValueError):
sshtunnel.check_address('this is not valid')
with self.assertRaises(ValueError):
sshtunnel.check_address(-1) # that's not valid either