def test__get_asyncssh_opt_autodetect(self, mock_hub): ''' Test getting option from autodetect of target and config aren't available ''' mock_hub.OPT = {'heist': {'roster_defaults': {}}} target = {} result = asyncssh_tunnel._get_asyncssh_opt(mock_hub, target=target, option='username', default='default') assert result == 'autodetect'
def test__get_asyncssh_opt_target(self, mock_hub): ''' Test getting option from the target ''' mock_hub.OPT = {'heist': {'username', 'opt'}} target = {'username': '******'} result = asyncssh_tunnel._get_asyncssh_opt(mock_hub, target=target, option='username', default='default') assert result == 'target'
def test__get_asyncssh_opt_config(self, mock_hub): ''' Test getting option from the config if target isn't available ''' mock_hub.OPT = {'heist': {'username': '******'}} target = {} result = asyncssh_tunnel._get_asyncssh_opt(mock_hub, target=target, option='username', default='default') assert result == 'opt'