MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / test_search_link_node

Function test_search_link_node

tests/nodes/search_link_node_test.py:42–63  ·  view source on GitHub ↗

Test the SearchLinkNode execution.

(setup)

Source from the content-addressed store, hash-verified

40
41
42def test_search_link_node(setup):
43 """
44 Test the SearchLinkNode execution.
45 """
46 search_link_node, initial_state = setup
47
48 # Patch the execute method to avoid actual network calls and return a mock response
49 with patch.object(
50 SearchLinkNode,
51 "execute",
52 return_value={"relevant_links": ["http://example.com"]},
53 ) as mock_execute:
54 result = search_link_node.execute(initial_state)
55
56 # Check if the result is not None
57 assert result is not None
58 # Additional assertion to check the returned value
59 assert "relevant_links" in result
60 assert isinstance(result["relevant_links"], list)
61 assert len(result["relevant_links"]) > 0
62 # Ensure the execute method was called once
63 mock_execute.assert_called_once_with(initial_state)

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected