4eeadd06a5
* refactor: move more commands to internal/cmd Part of https://github.com/ooni/probe/issues/1335. We would like all commands to be at the same level of engine rather than inside engine (now that we can do it). * fix: update .gitignore * refactor: also move jafar outside engine * We should be good now?
27 lines
430 B
Go
27 lines
430 B
Go
package geolocate
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/apex/log"
|
|
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
|
|
)
|
|
|
|
func TestIPLookupWorksUsingIPInfo(t *testing.T) {
|
|
ip, err := ipInfoIPLookup(
|
|
context.Background(),
|
|
http.DefaultClient,
|
|
log.Log,
|
|
httpheader.UserAgent(),
|
|
)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if net.ParseIP(ip) == nil {
|
|
t.Fatalf("not an IP address: '%s'", ip)
|
|
}
|
|
}
|