Byparr/tests/main_test.py

28 lines
623 B
Python
Raw Normal View History

2024-09-13 18:28:36 +00:00
from http import HTTPStatus
2024-09-13 18:04:37 +00:00
import pytest
2024-09-13 18:28:36 +00:00
from starlette.testclient import TestClient
2024-09-13 18:04:37 +00:00
2024-09-13 18:28:36 +00:00
from main import app
2024-09-13 18:04:37 +00:00
from src.models.requests import LinkRequest
2024-09-13 18:28:36 +00:00
client = TestClient(app)
2024-09-13 18:04:37 +00:00
test_websites = [
2024-09-13 19:13:37 +00:00
# "https://ext.to/",
# "https://btmet.com/",
2024-09-13 18:04:37 +00:00
"https://extratorrent.st/",
2024-09-13 19:13:37 +00:00
# "https://idope.se/",
2024-09-13 18:04:37 +00:00
]
@pytest.mark.parametrize("website", test_websites)
2024-09-13 18:28:36 +00:00
def test_bypass(website: str):
response = client.post(
"/v1",
2024-09-13 18:48:31 +00:00
json=LinkRequest(
url=website, maxTimeout=60 * len(test_websites), cmd="request.get"
).model_dump(),
2024-09-13 18:28:36 +00:00
)
assert response.status_code == HTTPStatus.OK