| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- """
- Tests de integración que requieren Camoufox funcionando.
- Estos tests pueden saltarse en CI con: pytest -m "not integration"
- """
- import pytest
- from fastapi.testclient import TestClient
- from app.main import app
- client = TestClient(app)
- @pytest.mark.integration
- class TestVisitEndpointIntegration:
- """Tests que ejecutan Camoufox realmente."""
- def test_visit_example_com(self):
- """Test básico con example.com."""
- response = client.post(
- "/api/v1/visit",
- json={"url": "https://example.com", "screenshot": False},
- )
- assert response.status_code == 200
- body = response.json()
- assert body["status"] == "OK"
- assert "html" in body["data"]
- @pytest.mark.skip(reason="Requiere Camoufox instalado y funcionando")
- def test_visit_with_screenshot(self):
- """Test con screenshot."""
- response = client.post(
- "/api/v1/visit",
- json={"url": "https://example.com", "screenshot": True},
- )
- assert response.status_code == 200
- body = response.json()
- assert body["status"] == "OK"
- assert body["data"]["screenshot"] is not None
- @pytest.mark.skip(reason="Requiere Camoufox instalado y funcionando")
- def test_visit_mercadolibre_url(self):
- """Test con URL de Mercado Libre (aplica hacks específicos)."""
- response = client.post(
- "/api/v1/visit",
- json={
- "url": "https://autos.mercadolibre.cl/auto",
- "screenshot": False,
- },
- )
- assert response.status_code == 200
- @pytest.mark.skip(reason="Requiere Camoufox instalado y funcionando")
- def test_visit_with_proxy(self):
- """Test con proxy."""
- response = client.post(
- "/api/v1/visit",
- json={
- "url": "https://example.com",
- "proxy": "http://proxy:8080",
- },
- )
- assert response.status_code == 200
- @pytest.mark.skip(reason="Requiere Camoufox instalado y funcionando")
- def test_visit_with_incognito(self):
- """Test con modo incógnito."""
- response = client.post(
- "/api/v1/visit",
- json={
- "url": "https://example.com",
- "incognito": True,
- },
- )
- assert response.status_code == 200
|