ooni-probe-cli/internal/engine/geolocate/ipconfig_test.go
Simone Basso f271e71c0b
geolocate: first pass of code review and minor fixes (#359)
* doc(geolocate): minor cleanup

* more minor cleanups of geolocate

* remove disabled test and see whether now it works
2021-06-04 16:06:24 +02:00

27 lines
434 B
Go

package geolocate
import (
"context"
"net"
"net/http"
"testing"
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
)
func TestIPLookupWorksUsingIPConfig(t *testing.T) {
ip, err := ipConfigIPLookup(
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)
}
}