File size: 604 Bytes
f085180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 # tests/test_scraper_tool.py

import pytest
from agent.scraper_tool import WebScraperTool

@pytest.fixture
def scraper():
    return WebScraperTool()

def test_scrape_html(monkeypatch, scraper):
    def mock_get(*args, **kwargs):
        class MockResponse:
            def raise_for_status(self): pass
            text = "<html><body><p>Test paragraph</p></body></html>"
        return MockResponse()

    monkeypatch.setattr("requests.get", mock_get)
    result = scraper.scrape("https://ai.google.dev/gemini-api/docs/models")
    
    assert "Test paragraph" in result["content"]