import requests import pytest def test_health_check(): assert requests.get("https://restful-booker.herokuapp.com/ping").status_code == 201 @pytest.fixture def auth_token(): body = {"username": "admin", "password": "password123"} resp = requests.post("https://restful-booker.herokuapp.com/auth", params=body) resp.raise_for_status() print(resp.text) token = resp.json()["token"] return token @pytest.mark.xfail(reason="Default credentials don't work on the prod server") def test_get_auth_token(auth_token): assert auth_token