mirror of
https://gitlab.com/MisterBiggs/testing-framework-comparison.git
synced 2025-08-03 11:51:28 +00:00
few more tests
This commit is contained in:
BIN
pytest/__pycache__/test_booking.cpython-313-pytest-8.3.5.pyc
Normal file
BIN
pytest/__pycache__/test_booking.cpython-313-pytest-8.3.5.pyc
Normal file
Binary file not shown.
Binary file not shown.
25
pytest/test_booking.py
Normal file
25
pytest/test_booking.py
Normal 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
|
@@ -3,6 +3,7 @@ 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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user