"""Tests for web_fetch skill."""

from skill import run


def test_run_returns_dict():
    result = run("https://httpbin.org/get")
    assert isinstance(result, dict)
    assert result["status_code"] == 200
    assert "content" in result
    assert "headers" in result


def test_run_follows_redirects():
    result = run("https://httpbin.org/redirect/1")
    assert result["status_code"] == 200


def test_run_handles_timeout():
    import pytest

    with pytest.raises(Exception):
        run("https://httpbin.org/delay/10", timeout=1.0)
