MCPcopy
hub / github.com/crowdsecurity/crowdsec / TestSmokeInfoValidIP

Function TestSmokeInfoValidIP

pkg/cticlient/client_test.go:257–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

255}
256
257func TestSmokeInfoValidIP(t *testing.T) {
258 ctiClient := NewCrowdsecCTIClient(WithAPIKey(validApiKey), WithHTTPClient(&http.Client{
259 Transport: RoundTripFunc(smokeHandler),
260 }))
261
262 resp, err := ctiClient.GetIPInfo("1.1.1.1")
263 if err != nil {
264 t.Fatalf("failed to get ip info: %s", err)
265 }
266
267 assert.Equal(t, "1.1.1.1", resp.Ip)
268 assert.Equal(t, new("1.1.1.0/24"), resp.IpRange)
269}
270
271func TestSmokeUnknownIP(t *testing.T) {
272 ctiClient := NewCrowdsecCTIClient(WithAPIKey(validApiKey), WithHTTPClient(&http.Client{

Callers

nothing calls this directly

Calls 5

GetIPInfoMethod · 0.95
NewCrowdsecCTIClientFunction · 0.85
WithAPIKeyFunction · 0.85
WithHTTPClientFunction · 0.85
RoundTripFuncFuncType · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…