How to use the sshtunnel.check_addresses 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 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
github pahaz / sshtunnel / tests / test_forwarder.py View on Github external
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