MCPcopy
hub / github.com/andeya/pholcus / TestCrawler_Process_success

Function TestCrawler_Process_success

app/crawler/crawler_test.go:161–176  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

159}
160
161func TestCrawler_Process_success(t *testing.T) {
162 scheduler.Init(4, 0)
163 cr := New(0, &successDownloader{}, "csv", 10).(*crawler)
164 sp := &spider.Spider{
165 Name: "TestSpider",
166 RuleTree: &spider.RuleTree{
167 Root: func(_ *spider.Context) {},
168 Trunk: map[string]*spider.Rule{"r": {ParseFunc: func(_ *spider.Context) {}}},
169 },
170 Limit: -5,
171 }
172 cr.Init(sp)
173 req := &request.Request{URL: "http://example.com", Rule: "r"}
174 req.Prepare()
175 cr.Process(req)
176}

Callers

nothing calls this directly

Calls 5

PrepareMethod · 0.95
InitFunction · 0.92
NewFunction · 0.70
InitMethod · 0.65
ProcessMethod · 0.65

Tested by

no test coverage detected