add logger even if passing

This commit is contained in:
Thephaseless 2024-10-21 13:46:26 +00:00
parent 4e6fbe0e95
commit b25cc134a8
3 changed files with 7 additions and 2 deletions

View File

@ -60,7 +60,7 @@ async def read_item(request: LinkRequest):
browser.stop() browser.stop()
except Exception as e: except Exception as e:
browser.stop() browser.stop()
raise HTTPException(detail="Couldn't bypass", status_code=408) from e raise HTTPException(detail="Couldn't bypass", status_code=500) from e
logger.info(f"Got webpage: {request.url}") logger.info(f"Got webpage: {request.url}")

View File

@ -49,5 +49,8 @@ ignore = [
select = ["ALL"] select = ["ALL"]
extend-safe-fixes = ["D415"] extend-safe-fixes = ["D415"]
[tool.pytest]
log_cli = "True"
[tool.pytest.ini_options] [tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function" asyncio_default_fixture_loop_scope = "function"

View File

@ -7,6 +7,7 @@ from starlette.testclient import TestClient
from main import app from main import app
from src.models.requests import LinkRequest from src.models.requests import LinkRequest
from src.utils import logger
client = TestClient(app) client = TestClient(app)
@ -16,7 +17,7 @@ test_websites = [
"https://extratorrent.st/", # github is blocking these "https://extratorrent.st/", # github is blocking these
"https://idope.se/", # github is blocking these "https://idope.se/", # github is blocking these
"https://www.ygg.re/", "https://www.ygg.re/",
"https://speed.cd/browse/freeleech", "https://speed.cd/",
] ]
@ -27,6 +28,7 @@ def test_bypass(website: str):
website, website,
) )
if test_request.status_code != HTTPStatus.OK: if test_request.status_code != HTTPStatus.OK:
logger.info(f"Skipping {website} due to {test_request.status_code}")
pytest.skip() pytest.skip()
response = client.post( response = client.post(