from gradio.image_utils import extract_svg_content def test_extract_svg_content_local_file(): svg_path = "test/test_files/file_icon.svg" svg_content = extract_svg_content(svg_path) assert ( svg_content == '' ) def test_extract_svg_content_from_url(monkeypatch): class MockResponse: def __init__(self): self.text = "mock svg content" def raise_for_status(self): pass async def mock_get(*args, **kwargs): return MockResponse() # extract_svg_content now routes through the SSRF-protected helper rather # than calling httpx.get directly, so patch that instead. monkeypatch.setattr("gradio.processing_utils.async_ssrf_protected_get", mock_get) svg_content = extract_svg_content("https://example.com/test.svg") assert svg_content == "mock svg content"