Python paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED Examples

The following are 3 code examples of paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module paramiko , or try the search function .
Example #1
Source File: test_transport.py    From python-hpedockerplugin with Apache License 2.0 5 votes vote down vote up
def check_channel_request(self, kind, chanid):
        if kind == 'bogus':
            return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
        return OPEN_SUCCEEDED 
Example #2
Source File: test_transport.py    From python-hpedockerplugin with Apache License 2.0 5 votes vote down vote up
def test_8_channel_exception(self):
        """
        verify that ChannelException is thrown for a bad open-channel request.
        """
        self.setup_test_server()
        try:
            chan = self.tc.open_channel('bogus')
            self.fail('expected exception')
        except ChannelException as e:
            self.assertTrue(e.code == OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED) 
Example #3
Source File: test_transport.py    From python-hpedockerplugin with Apache License 2.0 5 votes vote down vote up
def test_server_rejects_open_channel_without_auth(self):
        try:
            self.setup_test_server(connect_kwargs={})
            self.tc.open_session()
        except ChannelException as e:
            assert e.code == OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
        else:
            assert False, "Did not raise ChannelException!"