1
0
mirror of https://gitlab.com/MisterBiggs/testing-framework-comparison.git synced 2025-06-15 17:06:39 +00:00

few more tests

This commit is contained in:
Anson Biggs 2025-05-17 14:05:07 -06:00
parent bb51d7563e
commit d281c6d4ff
4 changed files with 29 additions and 3 deletions

25
pytest/test_booking.py Normal file
View File

@ -0,0 +1,25 @@
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

View File

@ -1,8 +1,9 @@
import pytest import pytest
# Thanks to https://pydevtools.com/handbook/tutorial/setting-up-testing-with-pytest-and-uv/ # Thanks to https://pydevtools.com/handbook/tutorial/setting-up-testing-with-pytest-and-uv/
# for the guide # for the guide
def add(a, b): def add(a, b):
return a + b return a + b
@ -47,4 +48,4 @@ def test_divide():
def test_divide_by_zero(): def test_divide_by_zero():
with pytest.raises(ValueError): with pytest.raises(ValueError):
divide(5, 0) divide(5, 0)