def test_missing_credentials(capsys, accept_requests): with pytest.raises(SystemExit): main(["--hostname", HOST]) assert capsys.readouterr() == ( "", "401 Client Error: Unauthorized for url: " "https://%s/%s/%s\n" % (HOST, API_PATH, REQUESTS[0]), )
def test_agent_output(capsys, accept_requests): main(["--debug", "--hostname", HOST, "-u", "%s:%s" % AUTH]) assert capsys.readouterr() == ( '<<<cisco_prime_wifi_access_points:sep(0)>>>\n' '{"authenticated": true, "user": "******"}\n' '<<<cisco_prime_wifi_connections:sep(0)>>>\n' '{"authenticated": true, "user": "******"}\n', '', )
def test_wrong_arguments(capsys): with pytest.raises(SystemExit): main([]) assert capsys.readouterr().out == ""