mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-15 09:50:20 +08:00
skip if test if client cant reach
This commit is contained in:
parent
9ca2059b91
commit
5a40851c22
@ -1,6 +1,7 @@
|
|||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
import httpx
|
||||||
import pytest
|
import pytest
|
||||||
from starlette.testclient import TestClient
|
from starlette.testclient import TestClient
|
||||||
|
|
||||||
@ -22,11 +23,15 @@ test_websites = [
|
|||||||
@pytest.mark.parametrize("website", test_websites)
|
@pytest.mark.parametrize("website", test_websites)
|
||||||
def test_bypass(website: str):
|
def test_bypass(website: str):
|
||||||
sleep(3)
|
sleep(3)
|
||||||
|
test_request = httpx.get(
|
||||||
|
website,
|
||||||
|
)
|
||||||
|
if test_request.status_code != HTTPStatus.OK:
|
||||||
|
pytest.skip()
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
"/v1",
|
"/v1",
|
||||||
json=LinkRequest(url=website, maxTimeout=30, cmd="request.get").model_dump(),
|
json=LinkRequest(url=website, maxTimeout=30, cmd="request.get").model_dump(),
|
||||||
)
|
)
|
||||||
if response.status_code == HTTPStatus.TOO_MANY_REQUESTS:
|
|
||||||
# if rate limited
|
|
||||||
pytest.skip()
|
|
||||||
assert response.status_code == HTTPStatus.OK
|
assert response.status_code == HTTPStatus.OK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user