18 lines
673 B
Python
18 lines
673 B
Python
import pytest
|
|
|
|
from app.crawler import _http_client
|
|
|
|
|
|
pytestmark = pytest.mark.network
|
|
|
|
|
|
@pytest.mark.parametrize("source_index", range(50))
|
|
def test_source_returns_a_response(source_manifest, source_index):
|
|
source = source_manifest[source_index]
|
|
with _http_client(timeout=30) as client:
|
|
response = client.get(source["url"])
|
|
assert response.status_code < 500, f"{source['name']} returned {response.status_code}"
|
|
assert response.content, f"{source['name']} returned an empty response"
|
|
content_type = response.headers.get("content-type", "")
|
|
assert any(value in content_type.lower() for value in ("html", "json", "xml", "text")), content_type
|