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:
parent
bb51d7563e
commit
d281c6d4ff
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
|
@ -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
|
||||
|
||||
|
||||
def add(a, b):
|
||||
return a + b
|
||||
|
||||
@ -47,4 +48,4 @@ def test_divide():
|
||||
|
||||
def test_divide_by_zero():
|
||||
with pytest.raises(ValueError):
|
||||
divide(5, 0)
|
||||
divide(5, 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user