def test_results(self): result = Api('localhost').command('whoami') assert result.rc('localhost') == 0 assert result.stdout('localhost') is not None assert result['contacted']['localhost']['rc'] == 0 result['contacted'] = [] assert result.rc('localhost') is None
def test_results(): result = Api('localhost').command('whoami') assert result.rc('localhost') == 0 assert result.stdout('localhost') is not None assert result['contacted']['localhost']['rc'] == 0 with pytest.raises(AttributeError): result.asdf('localhost') result['contacted'] = [] with pytest.raises(KeyError): result.rc('localhost')
def test_server_with_port(): # ideally we would test ipv6 here as well, but that doesn't work # on travis at the moment: # see https://github.com/travis-ci/travis-ci/issues/8891 for definition in ('localhost:22', ['localhost:22']): api = Api(definition) assert api.servers == ['localhost:22'] hosts, ports = zip(tuple(*api.hosts_with_ports)) assert hosts == ('localhost', ) assert ports == (22, ) result = Api('localhost').command('whoami') assert result.rc() == 0
def test_results_single_server(server): result = Api(server).command('whoami') assert result.rc() == 0 assert result.rc(server) == 0
def test_results_single_server(): result = Api('localhost').command('whoami') assert result.rc() == 0
def test_results_multiple_servers(self): result = Api(['localhost', '127.0.0.1']).command('whoami') with pytest.raises(KeyError): result.rc()