From 5a40851c22c8e781b4242ff43390cb9f75f00c87 Mon Sep 17 00:00:00 2001 From: Thephaseless Date: Mon, 21 Oct 2024 13:19:31 +0000 Subject: [PATCH] skip if test if client cant reach --- tests/main_test.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/main_test.py b/tests/main_test.py index 510223b..4d160cc 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -1,6 +1,7 @@ from http import HTTPStatus from time import sleep +import httpx import pytest from starlette.testclient import TestClient @@ -22,11 +23,15 @@ test_websites = [ @pytest.mark.parametrize("website", test_websites) def test_bypass(website: str): sleep(3) + test_request = httpx.get( + website, + ) + if test_request.status_code != HTTPStatus.OK: + pytest.skip() + response = client.post( "/v1", 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