From d281c6d4ff71ca1676cebc84e66d3c0867e1615b Mon Sep 17 00:00:00 2001 From: Anson Biggs Date: Sat, 17 May 2025 14:05:07 -0600 Subject: [PATCH] few more tests --- .../test_booking.cpython-313-pytest-8.3.5.pyc | Bin 0 -> 2912 bytes .../test_test.cpython-313-pytest-8.3.5.pyc | Bin 11513 -> 11513 bytes pytest/test_booking.py | 25 ++++++++++++++++++ pytest/test_test.py | 7 ++--- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 pytest/__pycache__/test_booking.cpython-313-pytest-8.3.5.pyc create mode 100644 pytest/test_booking.py diff --git a/pytest/__pycache__/test_booking.cpython-313-pytest-8.3.5.pyc b/pytest/__pycache__/test_booking.cpython-313-pytest-8.3.5.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd4fcd1ed78d8b74e3c98c04027731d46af16360 GIT binary patch literal 2912 zcma(TU2oe|^j^pLXxw()x{ZEFo2iDVAC@-#82f1W&^p03=%%<)ClzG5iQ9xGwz=0~ zZP8FBkmvwuPec3!*bm^9S9oi-p-LAdDls8VymaduPn>J}#_m+HS@F5&``mML?m6D; z>B%B^e*R~)dPYL%FHVR@4w1d@0J(>Bq~oiIV1JdaB&ejKD>6x{fh0vzz9dc3x-^7H z=EHRHh;S9HdSVDoha|~@&hbblu;QS=qE(mmG(i5fR6xQV%Q&ZA(=vz-N`X|rzirta6z(zW!bOBhEll!9d3aw}ziRCFW5xX>p z_F4BuRsuW7`Wl8kMwuOGRYD@x3pG3E`$A3WrF|w|T2mI9dMcMX4O!VKJ*{U-sd4O6 z>BW9=7P0*u6})JLN=XY}VzuB-6tK--46g)lqJZ7`6{K~|ZD>``bLsi9F=A0~xmiEG z#v3nyD(OQgQ8=mO&xowwz5LU_&LBIZ7dT=<)%Yc=~!?$zQo{_0pgsy z&JO!WR<+E!S2fC2tGr5H1?Ne4=}!P!=ntj;?#!K;EqP&U;3B}y8CV}Gvw&_Z*W1c< zE}35lU|U((2EPA$2z=#whYXP4S1?WH@j!!j;(=9y;XC=c8C1kAOUo z7xrN1XkWAD3HiP$%$TR`L^*n#3|q_|yGL%?QCu zwg9u~RW-~~a4pORWl0a(gss6`g{W}J9O|(?V%Dg|%iIXA7)!dOW_wKbtTliiL#1g6 zCNDXabtXf@aft@jl%Ft^B~iJnEDvP(-bo%9d|uKk09t5g;N%Y^bobr8eCP5vSHDlUyVcgE9i^}J zJ{bXb8~Isl*=*K5wM?vvWqUQa*=ohHU-wjA`>JEBUe!`v;#5>Pv`;O<(=aeZ{=k_ZeT9gkv@lE&d2XXOXhwe5h2BnhP5b|zmL~i&i}3kH_>d-i zYLR0c@NX;f3II*=b%RD0_Abi5hD1&D`|SpLw-GB2UijRa@=uT!`dc}+E${n1kdJMi z@9^6DsDQo2d44r$y(}ZzyuV{MXav147o-NwI!COVq~<}B@32@pFF6EV;I9*6M`s|3~CU4=O)1({L)yy7eY`3q-uaXbHe>0%QCqLSLdU z4*iaLo~1Cpfp;@V%6xU=_KByGf)DQ{kkq%!vE3ogAHF@jjgPePk*%Q*wgBR}rxM1; Mx!N`Cqkh=`0L|)TS^xk5 literal 0 HcmV?d00001 diff --git a/pytest/__pycache__/test_test.cpython-313-pytest-8.3.5.pyc b/pytest/__pycache__/test_test.cpython-313-pytest-8.3.5.pyc index fb9f1138c44495d2bb85339d6fd2dbf315605ec3..83d6ac02895506c7d8f92c973d9c0d3eacdd0bec 100644 GIT binary patch delta 96 zcmewv`7@I1GcPX}0}ybmSjff5$Ud2yF@=$PasgvBBR`Oon*5Bhg;98OHq&-aM#;^} yJV~5v@<7$ayCxUPPu;8_=FQ2dx;aOFBPXNwW;xAcOpJz;pK3p53NvKh=H=G~uL<0RR!68+-r& diff --git a/pytest/test_booking.py b/pytest/test_booking.py new file mode 100644 index 0000000..132ddbe --- /dev/null +++ b/pytest/test_booking.py @@ -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 \ No newline at end of file diff --git a/pytest/test_test.py b/pytest/test_test.py index e45003a..0fb21b6 100644 --- a/pytest/test_test.py +++ b/pytest/test_test.py @@ -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) \ No newline at end of file + divide(5, 0)